From c8d0ad493ab63f220574cb5e7a33aea93e8c01cb Mon Sep 17 00:00:00 2001 From: Akash Mahanty Date: Sun, 16 Jan 2022 21:22:43 +0530 Subject: [PATCH] defined __str__ for Url objects, print func should print the url. --- waybackpy/wrapper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/waybackpy/wrapper.py b/waybackpy/wrapper.py index 7cc50f5..ecaabb2 100644 --- a/waybackpy/wrapper.py +++ b/waybackpy/wrapper.py @@ -9,10 +9,16 @@ class Url: def __init__(self, url, user_agent=DEFAULT_USER_AGENT): self.url = url self.user_agent = str(user_agent) + self.archive_url = None self.wayback_machine_availability_api = WaybackMachineAvailabilityAPI( self.url, user_agent=self.user_agent ) + def __str__(self): + if not self.archive_url: + self.newest() + return self.archive_url + def save(self): self.wayback_machine_save_api = WaybackMachineSaveAPI( self.url, user_agent=self.user_agent