From d2574dc53761d7e1379ce9569ae24508102a8aea Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Sat, 4 Apr 2020 16:58:56 +0100 Subject: Properly update cookiejar This fixes a bug for Springer urls where the cookies wouldn't be properly carried over, resulting in a redirection failure. --- paper2remarkable/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paper2remarkable/utils.py b/paper2remarkable/utils.py index 39cf547..969dc32 100644 --- a/paper2remarkable/utils.py +++ b/paper2remarkable/utils.py @@ -122,8 +122,10 @@ def follow_redirects(url): if not "Location" in req.headers: break url = req.headers["Location"] - jar = req.cookies + jar.update(req.cookies) it += 1 + if it == 100: + logger.warning("Max redirects reached. There may be a problem.") jar = jar or req.cookies return url, jar -- cgit v1.2.3