From 6142e0b353dbbc233a04b03fbabbf5232d80d9d6 Mon Sep 17 00:00:00 2001 From: Akash Mahanty Date: Tue, 12 Jan 2021 10:07:14 +0530 Subject: [PATCH] get should retrive the last fetched archive by default --- waybackpy/wrapper.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/waybackpy/wrapper.py b/waybackpy/wrapper.py index 80491fe..218bc55 100644 --- a/waybackpy/wrapper.py +++ b/waybackpy/wrapper.py @@ -144,12 +144,17 @@ class Url: def get(self, url="", user_agent="", encoding=""): """ - Return the source code of the supplied URL. + Return the source code of the last archived URL, + if no URL is passed to this method. + If encoding is not supplied, it is auto-detected from the response itself by requests package. """ - if not url: + if not url and self._archive_url: + url = self._archive_url + + elif not url and not self._archive_url: url = _cleaned_url(self.url) if not user_agent: