Skip to content

Commit 2a563ec

Browse files
committed
Fix #64
1 parent d918dd4 commit 2a563ec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mechanize/_clientcookie.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,19 @@ def __getitem__(self, i):
188188
raise IndexError()
189189

190190

191+
try:
192+
from http.cookiejar import NETSCAPE_MAGIC_RGX
193+
except ImportError: # python < 3.10
194+
NETSCAPE_MAGIC_RGX = MCJ.magic_re
195+
196+
191197
class MozillaCookieJar(MCJ):
192198

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

196202
magic = f.readline()
197-
if not re.search(self.magic_re, magic):
203+
if not re.search(NETSCAPE_MAGIC_RGX, magic):
198204
f.close()
199205
raise LoadError(
200206
"%r does not look like a Netscape format cookies file" %

0 commit comments

Comments
 (0)