diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-12-09 22:54:36 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-12-09 22:54:36 +0100 |
commit | 88a9fd24bd375fd7119e824fa6c2f87aa6f60cf7 (patch) | |
tree | 7d2ecaeca18b3ccef5281f3bd79e233a234ed44f /plugins/readm.py | |
parent | 399ae2947a8d58b5b7819813d63e050177d2f0e0 (diff) |
Set plugins network request timeout to 30 seconds
Diffstat (limited to 'plugins/readm.py')
-rwxr-xr-x | plugins/readm.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/readm.py b/plugins/readm.py index 59b8125..2b4dffb 100755 --- a/plugins/readm.py +++ b/plugins/readm.py @@ -36,7 +36,7 @@ if len(sys.argv) < 2: def download_file(url, save_path): file_size = 0 - with requests.get(url, headers=headers, stream=True) as response: + with requests.get(url, headers=headers, stream=True, timeout=30) as response: if not response.ok: return 0 with open(save_path, "wb") as file: @@ -47,7 +47,7 @@ def download_file(url, save_path): return file_size def list_chapters(url, chapter_list_input): - response = requests.get(url, headers=headers) + response = requests.get(url, headers=headers, timeout=30) response.raise_for_status() seen_titles = set() @@ -75,7 +75,7 @@ def list_chapters(url, chapter_list_input): print(json.dumps(chapters)) def download_chapter(url, download_dir): - response = requests.get(url) + response = requests.get(url, timeout=30) response.raise_for_status() in_progress_filepath = os.path.join(download_dir, ".in_progress") |