pywaybackup 1.2.1__tar.gz → 1.2.3__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.2.1 → pywaybackup-1.2.3}/PKG-INFO +1 -1
- pywaybackup-1.2.3/pywaybackup/__version__.py +1 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/archive.py +19 -16
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup.egg-info/PKG-INFO +1 -1
- pywaybackup-1.2.1/pywaybackup/__version__.py +0 -1
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/LICENSE +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/README.md +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/Exception.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/SnapshotCollection.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/Verbosity.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/__init__.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/arguments.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/helper.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup/main.py +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup.egg-info/SOURCES.txt +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup.egg-info/dependency_links.txt +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup.egg-info/entry_points.txt +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup.egg-info/requires.txt +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/pywaybackup.egg-info/top_level.txt +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/setup.cfg +0 -0
- {pywaybackup-1.2.1 → pywaybackup-1.2.3}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.3"
|
|
@@ -11,6 +11,8 @@ import http.client
|
|
|
11
11
|
from urllib.parse import urljoin
|
|
12
12
|
from datetime import datetime, timezone
|
|
13
13
|
|
|
14
|
+
from socket import timeout
|
|
15
|
+
|
|
14
16
|
from pywaybackup.helper import url_get_timestamp, url_split, move_index, sanitize_filename
|
|
15
17
|
|
|
16
18
|
from pywaybackup.SnapshotCollection import SnapshotCollection as sc
|
|
@@ -130,7 +132,9 @@ def query_list(url: str, range: int, start: int, end: int, explicit: bool, mode:
|
|
|
130
132
|
try:
|
|
131
133
|
cdxResult = requests.get(cdxQuery).text
|
|
132
134
|
except requests.exceptions.ConnectionError as e:
|
|
133
|
-
|
|
135
|
+
vb.write("\nCONNECTION REFUSED -> could not query cdx server (max retries exceeded)\n")
|
|
136
|
+
os._exit(1)
|
|
137
|
+
#ex.exception("Could not query snapshots", e)
|
|
134
138
|
|
|
135
139
|
if cdxbackup:
|
|
136
140
|
os.makedirs(cdxbackup, exist_ok=True)
|
|
@@ -220,9 +224,10 @@ def download_loop(snapshot_queue, output, worker, retry, no_redirect, skipset=No
|
|
|
220
224
|
vb.write(progress=1)
|
|
221
225
|
if failed_urls:
|
|
222
226
|
if not attempt > max_attempt:
|
|
227
|
+
attempt += 1
|
|
223
228
|
vb.write(f"\n-----> Worker: {worker} - Retry Timeout: 15 seconds")
|
|
224
229
|
time.sleep(15)
|
|
225
|
-
download_loop(
|
|
230
|
+
download_loop(snapshot_queue, output, worker, retry, no_redirect, skipset, attempt, connection, failed_urls)
|
|
226
231
|
except Exception as e:
|
|
227
232
|
ex.exception(f"Worker: {worker} - Exception", e)
|
|
228
233
|
snapshot_queue.put(snapshot) # requeue snapshot if worker crashes
|
|
@@ -329,20 +334,8 @@ def download(output, snapshot_entry, connection, status_message, no_redirect=Fal
|
|
|
329
334
|
f" -> {e}"
|
|
330
335
|
vb.write(status_message)
|
|
331
336
|
return False
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
status_message = f"{status_message}\n" + \
|
|
335
|
-
f"TIMEOUT -> ({i+1}/{max_retries}), reconnect in {sleep_time} seconds...\n" + \
|
|
336
|
-
f" -> {e}"
|
|
337
|
-
vb.write(status_message)
|
|
338
|
-
time.sleep(sleep_time)
|
|
339
|
-
# connection refused waits and retries
|
|
340
|
-
except ConnectionRefusedError as e:
|
|
341
|
-
status_message = f"{status_message}\n" + \
|
|
342
|
-
f"REFUSED -> ({i+1}/{max_retries}), reconnect in {sleep_time} seconds...\n" + \
|
|
343
|
-
f" -> {e}"
|
|
344
|
-
vb.write(status_message)
|
|
345
|
-
time.sleep(sleep_time)
|
|
337
|
+
except (timeout, ConnectionRefusedError, ConnectionResetError) as e:
|
|
338
|
+
download_exception(type, e, i, max_retries, sleep_time, status_message)
|
|
346
339
|
vb.write(f"FAILED -> download, append to failed_urls: {download_url}")
|
|
347
340
|
return False
|
|
348
341
|
|
|
@@ -357,6 +350,16 @@ RESPONSE_CODE_DICT = {
|
|
|
357
350
|
503: "Service Unavailable"
|
|
358
351
|
}
|
|
359
352
|
|
|
353
|
+
def download_exception(type, e, i, max_retries, sleep_time, status_message):
|
|
354
|
+
"""
|
|
355
|
+
Handle exceptions during the download process.
|
|
356
|
+
"""
|
|
357
|
+
type = e.__class__.__name__.upper()
|
|
358
|
+
status_message = f"{status_message}\n" + \
|
|
359
|
+
f"{type} -> ({i+1}/{max_retries}), reconnect in {sleep_time} seconds...\n"
|
|
360
|
+
vb.write(status_message)
|
|
361
|
+
time.sleep(sleep_time)
|
|
362
|
+
|
|
360
363
|
def parse_response_code(response_code: int):
|
|
361
364
|
"""
|
|
362
365
|
Parse the response code of the Wayback Machine and return a human-readable message.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.1"
|
|
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
|