pywaybackup 1.4.0__tar.gz → 1.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pywaybackup-1.4.0/pywaybackup.egg-info → pywaybackup-1.4.2}/PKG-INFO +1 -1
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/Verbosity.py +2 -1
- pywaybackup-1.4.2/pywaybackup/__version__.py +1 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/archive.py +20 -18
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/helper.py +1 -1
- {pywaybackup-1.4.0 → pywaybackup-1.4.2/pywaybackup.egg-info}/PKG-INFO +1 -1
- pywaybackup-1.4.0/pywaybackup/__version__.py +0 -1
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/.github/ISSUE_TEMPLATE/bug.md +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/.gitignore +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/LICENSE +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/README.md +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/dev/pip_build.sh +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/dev/venv_create.sh +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/Arguments.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/Converter.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/Exception.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/SnapshotCollection.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/__init__.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup/main.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup.egg-info/SOURCES.txt +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup.egg-info/dependency_links.txt +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup.egg-info/entry_points.txt +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup.egg-info/requires.txt +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/pywaybackup.egg-info/top_level.txt +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/requirements.txt +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/setup.cfg +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/setup.py +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/test/cdx.example.com.200 +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/test/cdx.example.com.404 +0 -0
- {pywaybackup-1.4.0 → pywaybackup-1.4.2}/test/cdx.example.com.small.200 +0 -0
|
@@ -88,12 +88,13 @@ class Message(Verbosity):
|
|
|
88
88
|
self.message = {}
|
|
89
89
|
|
|
90
90
|
def __str__(self):
|
|
91
|
-
return self.message
|
|
91
|
+
return str(self.message)
|
|
92
92
|
|
|
93
93
|
def store(self, status: str = "", type: str = "", message: str = "", level: str = "info"):
|
|
94
94
|
if level not in self.message:
|
|
95
95
|
self.message[level] = []
|
|
96
96
|
self.message[level].append(super().generate_logline(status, type, message))
|
|
97
|
+
#super().write(message=f"Stored message: {status} -> {type}: {message}")
|
|
97
98
|
|
|
98
99
|
def clear(self):
|
|
99
100
|
self.message = {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.4.2"
|
|
@@ -263,7 +263,7 @@ def download(output, snapshot_entry, connection, status_message, no_redirect=Fal
|
|
|
263
263
|
download_url = snapshot_entry["url_archive"]
|
|
264
264
|
encoded_download_url = urllib.parse.quote(download_url, safe=':/') # used for GET - otherwise always download_url
|
|
265
265
|
max_retries = 2
|
|
266
|
-
sleep_time =
|
|
266
|
+
sleep_time = 50
|
|
267
267
|
headers = {'User-Agent': f'bitdruid-python-wayback-downloader/{__version__}'}
|
|
268
268
|
success = False
|
|
269
269
|
for i in range(max_retries):
|
|
@@ -325,7 +325,7 @@ def download(output, snapshot_entry, connection, status_message, no_redirect=Fal
|
|
|
325
325
|
status_message.store(status="UNEXPECTED", type="HTTP", message=f"{response.status} - {response_status_message}")
|
|
326
326
|
status_message.store(status="", type="URL", message=download_url)
|
|
327
327
|
status_message.write()
|
|
328
|
-
|
|
328
|
+
break
|
|
329
329
|
# exception handling
|
|
330
330
|
except (http.client.HTTPException, timeout, ConnectionRefusedError, ConnectionResetError) as e:
|
|
331
331
|
download_exception(type, e, i, max_retries, sleep_time, status_message)
|
|
@@ -390,24 +390,26 @@ def csv_close(csv_path: str, url: str):
|
|
|
390
390
|
try:
|
|
391
391
|
csv_path = csv_filepath(csv_path, url)
|
|
392
392
|
if sc.count(collection=True) > 0:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
393
|
+
new_rows = [snapshot for snapshot in sc.SNAPSHOT_COLLECTION
|
|
394
|
+
if ("response" in snapshot and snapshot["response"] is not False and "url_archive" in snapshot) or
|
|
395
|
+
("digest" in snapshot)]
|
|
396
|
+
|
|
397
|
+
if os.path.exists(csv_path): # append to existing file
|
|
398
|
+
existing_rows = set(csv_read(open(csv_path, mode='r', newline='')))
|
|
399
|
+
|
|
400
|
+
with open(csv_path, mode='a', newline='') as file: # append new rows
|
|
401
|
+
row_writer = csv.DictWriter(file, sc.SNAPSHOT_COLLECTION[0].keys())
|
|
402
|
+
for snapshot in new_rows:
|
|
403
|
+
snapshot_tuple = tuple(snapshot.values())
|
|
404
|
+
if snapshot_tuple not in existing_rows:
|
|
405
|
+
row_writer.writerow(snapshot)
|
|
406
|
+
else: # create new file
|
|
403
407
|
with open(csv_path, mode='w', newline='') as file:
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if snapshot["response"] is not False: # only append handled snapshots
|
|
408
|
-
row.writerow(snapshot)
|
|
408
|
+
row_writer = csv.DictWriter(file, sc.SNAPSHOT_COLLECTION[0].keys())
|
|
409
|
+
row_writer.writeheader()
|
|
410
|
+
row_writer.writerows(new_rows)
|
|
409
411
|
except Exception as e:
|
|
410
|
-
ex.exception("Could not save CSV
|
|
412
|
+
ex.exception("Could not save CSV file", e)
|
|
411
413
|
|
|
412
414
|
def csv_read(csv_file: object) -> list:
|
|
413
415
|
"""
|
|
@@ -37,7 +37,7 @@ def url_get_timestamp(url):
|
|
|
37
37
|
"""
|
|
38
38
|
Extract the timestamp from a wayback machine URL.
|
|
39
39
|
"""
|
|
40
|
-
timestamp = url.split("web
|
|
40
|
+
timestamp = url.split("web/")[1].split("/")[0]
|
|
41
41
|
if "id_" in url: timestamp = timestamp.split("id_")[0]
|
|
42
42
|
return timestamp
|
|
43
43
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|