CookieFix

This commit is contained in:
KEriks 2022-03-21 16:40:46 +02:00
parent 288c3df4a5
commit 7015b6d299
2 changed files with 5 additions and 2 deletions

View File

@ -112,7 +112,7 @@ class ErepublikErrorHTTTPHandler(handlers.HTTPHandler):
def _get_last_response(self) -> Dict[str, str]: def _get_last_response(self) -> Dict[str, str]:
response = self.reporter.citizen.r response = self.reporter.citizen.r
url = response.url url = str(response.url)
last_index = url.index("?") if "?" in url else len(response.url) last_index = url.index("?") if "?" in url else len(response.url)
name = slugify(response.url[len(self.reporter.citizen.url) : last_index]) name = slugify(response.url[len(self.reporter.citizen.url) : last_index])

View File

@ -613,7 +613,10 @@ class BaseCitizen(access_points.CitizenAPI):
"comment_url", "comment_url",
"rfc2109", "rfc2109",
] ]
cookies = [{attr: getattr(cookie, attr) for attr in cookie_attrs} for cookie in self._req.cookies] cookies = []
for cookie in self._req.cookies.jar:
cookies.append({attr: getattr(cookie, attr, None) for attr in cookie_attrs if hasattr(cookie, attr)})
#cookies = [{attr: getattr(cookie, attr) for attr in cookie_attrs} for cookie in self._req.cookies]
with open(filename, "w") as f: with open(filename, "w") as f:
utils.json_dump( utils.json_dump(