aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2020-04-04 16:58:56 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2020-04-04 16:58:56 +0100
commitd2574dc53761d7e1379ce9569ae24508102a8aea (patch)
tree192c77e548b1516ec83ccc81b6fa75f7722cf136
parentMove arXiv tests to a separate file (diff)
downloadpaper2remarkable-d2574dc53761d7e1379ce9569ae24508102a8aea.tar.gz
paper2remarkable-d2574dc53761d7e1379ce9569ae24508102a8aea.zip
Properly update cookiejar
This fixes a bug for Springer urls where the cookies wouldn't be properly carried over, resulting in a redirection failure.
-rw-r--r--paper2remarkable/utils.py4
1 files changed, 3 insertions, 1 deletions
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