Update wrapper.py

This commit is contained in:
Akash
2020-07-19 19:58:48 +05:30
committed by GitHub
parent 3fb412b26e
commit 0aa51c961b

View File

@@ -8,9 +8,9 @@ from waybackpy.exceptions import WaybackError
if sys.version_info >= (3, 0): # If the python ver >= 3
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
from urllib.error import URLError
else: # For python2.x
from urllib2 import Request, urlopen, HTTPError, URLError
from urllib2 import Request, urlopen, URLError
default_UA = "waybackpy python package - https://github.com/akamhy/waybackpy"
@@ -59,13 +59,6 @@ class Url():
str(kwargs["minute"]).zfill(2)
)
def handle_HTTPError(self, e):
"""Handle some common HTTPErrors."""
if e.code == 404:
raise HTTPError(e)
if e.code >= 400:
raise WaybackError(e)
def save(self):
"""Create a new archives for an URL on the Wayback Machine."""
request_url = ("https://web.archive.org/save/" + self.clean_url())