From c1c689cb94f69859d46ea085522b7c704dc83f20 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 10 Jun 2018 21:13:07 -0400 Subject: [PATCH] log wget 404 and 403 errors --- archiver/archive_methods.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/archiver/archive_methods.py b/archiver/archive_methods.py index 5a923673..46032f88 100644 --- a/archiver/archive_methods.py +++ b/archiver/archive_methods.py @@ -208,7 +208,13 @@ def fetch_wget(link_dir, link, requisites=FETCH_WGET_REQUISITES, timeout=TIMEOUT print(' got wget response code {}:'.format(result.returncode)) print('\n'.join(' ' + line for line in (result.stderr or result.stdout).decode().rsplit('\n', 10)[-10:] if line.strip())) if result.returncode == 4: - raise Exception('Failed to wget download') + raise Exception('Failed wget download') + + if result.returncode > 0 and b'403: Forbidden' in result.stderr: + raise Exception('403 Forbidden (try changing WGET_USER_AGENT)') + + if result.returncode > 0 and b'404: Not Found' in result.stderr: + raise Exception('404 Not Found') except Exception as e: end() print(' Run to see full output:', 'cd {}; {}'.format(link_dir, ' '.join(CMD)))