Skip to content

Commit

Permalink
removed JSON from init, this was resulting in too much unnecessary ta…
Browse files Browse the repository at this point in the history
…ffic. Some users who are thousands of URLs were blocked by IA (#53)

closes #52
  • Loading branch information
akamhy authored Jan 1, 2021
1 parent da390ee commit 1b499a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Files generated while testing
*-urls-*.txt

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
4 changes: 2 additions & 2 deletions waybackpy/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def __init__(self, url, user_agent=default_UA):
self.url = url
self.user_agent = user_agent
self._url_check() # checks url validity on init.
self.JSON = self._JSON() # JSON of most recent archive
self.archive_url = self._archive_url() # URL of archive
self.timestamp = self._archive_timestamp() # timestamp for last archive
self._alive_url_list = []
Expand All @@ -90,7 +89,8 @@ def _url_check(self):
if "." not in self.url:
raise URLError("'%s' is not a vaild URL." % self.url)

def _JSON(self):
@property
def JSON(self):
endpoint = "https://archive.org/wayback/available"
headers = {"User-Agent": "%s" % self.user_agent}
payload = {"url": "%s" % self._clean_url()}
Expand Down

0 comments on commit 1b499a7

Please sign in to comment.