From ed24184b99d9d355d9afa4252d8ef53e02b0c88f Mon Sep 17 00:00:00 2001 From: Akash <64683866+akamhy@users.noreply.github.com> Date: Fri, 24 Jul 2020 00:57:22 +0530 Subject: [PATCH] Remove duplicate get response method --- waybackpy/wrapper.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/waybackpy/wrapper.py b/waybackpy/wrapper.py index 3f555f2..06029ce 100644 --- a/waybackpy/wrapper.py +++ b/waybackpy/wrapper.py @@ -51,10 +51,12 @@ def _get_response(req): try: response = urlopen(req) # nosec except Exception as e: - raise WaybackError(e) + exc = WaybackError("Error while retrieving %s" % req.full_ur + ) + exc.__cause__ = e + raise exc return response - class Url: """waybackpy Url object""" @@ -108,19 +110,6 @@ class Url: encoding = "UTF-8" 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): """ Return the closest Wayback Machine archive to the time supplied. Supported params are year, month, day, hour and minute.