akamhy / waybackpy

Wayback Machine API interface & a command-line tool
https://pypi.org/project/waybackpy/
MIT License
453 stars 32 forks source link

Fix save retry mechanism #124

Closed eggplants closed 2 years ago

eggplants commented 2 years ago

WaybackMachineSaveAPI.save raises AttributeError: 'WaybackMachineSaveAPI' object has no attribute 'response_url' when max_tries < 1.


$ pip show waybackpy
Name: waybackpy
Version: 3.0.2
Summary: Python package that interfaces with the Internet Archive's Wayback Machine APIs. Archive pages and retrieve archived pages easily.
Home-page: https://akamhy.github.io/waybackpy/
Author: Akash Mahanty
Author-email: akamhy@yahoo.com
License: MIT
Location: /Users/eggplants/.pyenv/versions/3.9.9/lib/python3.9/site-packages
Requires: click, requests
Required-by: wbsv
$ python -c 'import waybackpy;waybackpy.WaybackMachineSaveAPI("https://google.co.jp", max_tries=0).save()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/eggplants/.pyenv/versions/3.9.9/lib/python3.9/site-packages/waybackpy/save_api.py", line 170, in save
    % (self.url, self.response_url, str(self.headers)),
AttributeError: 'WaybackMachineSaveAPI' object has no attribute 'response_url'