From d9a3c0fcfebad6c1ae6ddc7f4eddbf2e2eddf591 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 7 Jun 2019 11:42:09 -0400 Subject: [PATCH 1/2] add docstring --- HTMLFormatter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/HTMLFormatter.py b/HTMLFormatter.py index cbb8ab4..2730a7d 100644 --- a/HTMLFormatter.py +++ b/HTMLFormatter.py @@ -50,6 +50,7 @@ class XMLishFormatter (BaseFormatter.BaseFormatter): def fix_dc (self, dc, os): """ Tweak dc. """ def has_std_path (file_obj): + ''' so cloudstorage links can be elided when the url is non-standard''' if file_obj.filetype == 'pdf': return STD_PDF_MATCH.search (file_obj.url) return True From ee826a514883fad1a0d06af952a58eac5ea634e6 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 7 Jun 2019 11:42:47 -0400 Subject: [PATCH 2/2] turn off gzip encoding --- CloudStorage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CloudStorage.py b/CloudStorage.py index 3033dde..4b3679b 100644 --- a/CloudStorage.py +++ b/CloudStorage.py @@ -218,8 +218,12 @@ class CloudStorage (object): url = session.ebook.get_source_url () # Caveat: use requests.get, not session.get, because it is an insecure # transport. session.get would raise InsecureTransportError + # turn off server encoding since we're going to re-stream the bytes return requests.get ( - url, headers = { 'user-agent': self.user_agent }, stream = True) + url, + headers = {'user-agent': self.user_agent, 'accept-encoding': ''}, + stream = True + ) def fix_filename (self, filename):