From b3c93c43b2c4b556d7ae3933035352c5c937e2ce Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 17 Apr 2018 17:16:41 -0400 Subject: [PATCH] fix archive.org content-location capitalization --- archive_methods.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archive_methods.py b/archive_methods.py index e1f5b4ed..1b3d6914 100644 --- a/archive_methods.py +++ b/archive_methods.py @@ -310,11 +310,11 @@ def archive_dot_org(link_dir, link, timeout=TIMEOUT): # Parse archive.org response headers headers = result.stdout.splitlines() - content_location = [h for h in headers if b'Content-Location: ' in h] + content_location = [h for h in headers if b'content-location: ' in h] errors = [h for h in headers if h and b'X-Archive-Wayback-Runtime-Error: ' in h] if content_location: - archive_path = content_location[0].split(b'Content-Location: ', 1)[-1].decode('utf-8') + archive_path = content_location[0].split(b'content-location: ', 1)[-1].decode('utf-8') saved_url = 'https://web.archive.org{}'.format(archive_path) success = True @@ -324,7 +324,7 @@ def archive_dot_org(link_dir, link, timeout=TIMEOUT): elif errors: raise Exception(', '.join(e.decode() for e in errors)) else: - raise Exception('Failed to find "Content-Location" URL header in Archive.org response.') + raise Exception('Failed to find "content-location" URL header in Archive.org response.') except Exception as e: end() print(' Visit url to see output:', ' '.join(CMD))