From 2a9f147bf99b20b6d5ecaf23e0db01cecbccc018 Mon Sep 17 00:00:00 2001 From: Gregory LEOCADIE Date: Tue, 27 Aug 2019 09:47:19 +0200 Subject: [PATCH] Avoid retrieving truncated book chapters/pages/sections When modifying the 'sessionid' after each call to oreilly api, there are calls that are considered not-authenticated and we retrieved truncated chapters/pages. By avoiding adding/modifying it, all the calls are correctly authenticated and we manage to retrieve full chapters/pages. --- safaribooks.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/safaribooks.py b/safaribooks.py index d66730b..5ff43db 100644 --- a/safaribooks.py +++ b/safaribooks.py @@ -386,9 +386,10 @@ class SafariBooks: def update_cookies(self, jar): for cookie in jar: - self.cookies.update({ - cookie.name: cookie.value - }) + if cookie.name != 'sessionid': + self.cookies.update({ + cookie.name: cookie.value + }) def requests_provider( self, url, post=False, data=None, perfom_redirect=True, update_cookies=True, update_referer=True, **kwargs