Skip to content

Commit

Permalink
Fix #64
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jun 12, 2021
1 parent d918dd4 commit 2a563ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mechanize/_clientcookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,19 @@ def __getitem__(self, i):
raise IndexError()


try:
from http.cookiejar import NETSCAPE_MAGIC_RGX
except ImportError: # python < 3.10
NETSCAPE_MAGIC_RGX = MCJ.magic_re


class MozillaCookieJar(MCJ):

def _really_load(self, f, filename, ignore_discard, ignore_expires):
now = time.time()

magic = f.readline()
if not re.search(self.magic_re, magic):
if not re.search(NETSCAPE_MAGIC_RGX, magic):
f.close()
raise LoadError(
"%r does not look like a Netscape format cookies file" %
Expand Down

0 comments on commit 2a563ec

Please # to comment.