From 340475a411d05dd41cc6107f837e05736a2b1db6 Mon Sep 17 00:00:00 2001 From: akamhy <64683866+akamhy@users.noreply.github.com> Date: Sat, 2 May 2020 16:12:41 +0530 Subject: [PATCH] Update wrapper.py --- pywayback/wrapper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pywayback/wrapper.py b/pywayback/wrapper.py index 6702d18..b82d6a6 100644 --- a/pywayback/wrapper.py +++ b/pywayback/wrapper.py @@ -38,7 +38,11 @@ def save(url,UA="pywayback python module"): try: response = urlopen(req) #nosec except urllib.error.HTTPError as e: - raise TooManyArchivingRequestsError(e) + if e.code == 502: + raise PageNotSavedError(e) + elif e.code == 429: + raise TooManyArchivingRequestsError(e) + header = response.headers if "exclusion.robots.policy" in str(header): raise ArchivingNotAllowed("Can not archive %s. Disabled by site owner." % (url))