If cookie has path attribute set to empty, mechanize thinks that it is incorrect and bypass them.
But all modern browser (ie, firefox, chrome) work correctly with empty path attributes.
I have a quick patch:
diff --git a/mechanize/_clientcookie.py b/mechanize/_clientcookie.py
index 2ed4c87..2af778a 100644
--- a/mechanize/_clientcookie.py
+++ b/mechanize/_clientcookie.py
@@ -1291,6 +1291,9 @@ class CookieJar:
is a request to discard (old and new) cookie, though.
k = "expires"
v = self._now + v
if k == "path":
if v is None:
v = "/"
if (k in value_attrs) or (k in boolean_attrs):
if (v is None and
k not in ["port", "comment", "commenturl"]):
If cookie has path attribute set to empty, mechanize thinks that it is incorrect and bypass them. But all modern browser (ie, firefox, chrome) work correctly with empty path attributes. I have a quick patch:
diff --git a/mechanize/_clientcookie.py b/mechanize/_clientcookie.py index 2ed4c87..2af778a 100644 --- a/mechanize/_clientcookie.py +++ b/mechanize/_clientcookie.py @@ -1291,6 +1291,9 @@ class CookieJar:
is a request to discard (old and new) cookie, though.