Remove duplicate get response method

This commit is contained in:
Akash 2020-07-24 00:57:22 +05:30
parent 56bef064b1
commit ed24184b99

View File

@ -51,10 +51,12 @@ def _get_response(req):
try: try:
response = urlopen(req) # nosec response = urlopen(req) # nosec
except Exception as e: except Exception as e:
raise WaybackError(e) exc = WaybackError("Error while retrieving %s" % req.full_ur
)
exc.__cause__ = e
raise exc
return response return response
class Url: class Url:
"""waybackpy Url object""" """waybackpy Url object"""
@ -108,19 +110,6 @@ class Url:
encoding = "UTF-8" encoding = "UTF-8"
return response.read().decode(encoding.replace("text/html", "UTF-8", 1)) return response.read().decode(encoding.replace("text/html", "UTF-8", 1))
def get_response(self, req):
"""Get response for the supplied request."""
try:
response = urlopen(req) #nosec
except Exception:
try:
response = urlopen(req) #nosec
except Exception as e:
exc = WaybackError("Error while retrieving %s" % req.full_url)
exc.__cause__ = e
raise exc
return response
def near(self, year=None, month=None, day=None, hour=None, minute=None): def near(self, year=None, month=None, day=None, hour=None, minute=None):
""" Return the closest Wayback Machine archive to the time supplied. """ Return the closest Wayback Machine archive to the time supplied.
Supported params are year, month, day, hour and minute. Supported params are year, month, day, hour and minute.