docstrings

This commit is contained in:
Akash Mahanty
2021-01-26 02:13:52 +05:30
parent 7e2b51b155
commit 817c0ee844

View File

@@ -85,12 +85,12 @@ class Url:
@property @property
def archive_url(self): def archive_url(self):
""" """Return the string form of the Url object.
Returns any random archive for the instance.
But if near, oldest, newest were used before
then it returns the same archive again.
We cache the archive in self._archive_url Parameters
----------
self : waybackpy.wrapper.Url
The instance itself.
""" """
if self._archive_url: if self._archive_url:
@@ -110,11 +110,24 @@ class Url:
@property @property
def _timestamp(self): def _timestamp(self):
"""Sets the value of self.timestamp if still not set.""" """Sets the value of self.timestamp if still not set.
Parameters
----------
self : waybackpy.wrapper.Url
The instance itself.
"""
return _timestamp_manager(self.timestamp, self.JSON) return _timestamp_manager(self.timestamp, self.JSON)
def save(self): def save(self):
""" """Saves/Archive the URL.
Parameters
----------
self : waybackpy.wrapper.Url
The instance itself.
To save a webpage on WayBack machine we To save a webpage on WayBack machine we
need to send get request to https://web.archive.org/save/ need to send get request to https://web.archive.org/save/
@@ -204,6 +217,29 @@ class Url:
unix_timestamp=None, unix_timestamp=None,
): ):
""" """
Parameters
----------
self : waybackpy.wrapper.Url
The instance itself.
year : int
Archive close to year
month : int
Archive close to month
day : int
Archive close to day
hour : int
Archive close to hour
minute : int
Archive close to minute
unix_timestamp : str, float or int
Archive close to this unix_timestamp
Wayback Machine can have many archives of a webpage, Wayback Machine can have many archives of a webpage,
sometimes we want archive close to a specific time. sometimes we want archive close to a specific time.
@@ -276,6 +312,7 @@ class Url:
We simply pass the year in near() and return it. We simply pass the year in near() and return it.
""" """
return self.near(year=year) return self.near(year=year)
def newest(self): def newest(self):
@@ -287,10 +324,26 @@ class Url:
Due to Wayback Machine database lag, this may not always be the Due to Wayback Machine database lag, this may not always be the
most recent archive. most recent archive.
""" """
return self.near() return self.near()
def total_archives(self, start_timestamp=None, end_timestamp=None): def total_archives(self, start_timestamp=None, end_timestamp=None):
""" """Returns the total number of archives for an URL
Parameters
----------
self : waybackpy.wrapper.Url
The instance itself
start_timestamp : str
1 to 14 digit string of numbers, you are not required to
pass a full 14 digit timestamp.
end_timestamp : str
1 to 14 digit string of numbers, you are not required to
pass a full 14 digit timestamp.
A webpage can have multiple archives on the wayback machine A webpage can have multiple archives on the wayback machine
If someone wants to count the total number of archives of a If someone wants to count the total number of archives of a
webpage on wayback machine they can use this method. webpage on wayback machine they can use this method.
@@ -319,7 +372,8 @@ class Url:
end_timestamp=None, end_timestamp=None,
match_type="prefix", match_type="prefix",
): ):
""" """Yields known_urls URLs from the CDX API.
Parameters Parameters
---------- ----------