From 8365ed51a6c9ffc12efc7fffaf0db4698408ede2 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 3 Apr 2023 04:59:03 -0400 Subject: [PATCH] Lower to 3 attempts --- c3dbdl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/c3dbdl b/c3dbdl index f6e69e6..c60b162 100755 --- a/c3dbdl +++ b/c3dbdl @@ -31,9 +31,9 @@ def buildDatabase(pages=None): for i in range(1, pages + 1): attempts = 1 p = None - while attempts <= 5: + while attempts <= 3: try: - click.echo(f"Parsing page {i} (attempt #{attempts})...") + click.echo(f"Parsing page {i} (attempt {attempts}/3)...") p = requests.get(f"{config['base_songs_url']}?page={i}") break except Exception: @@ -121,12 +121,12 @@ def downloadSong(destination, filename, entry): p = None try: with requests.get(download_url, stream=True) as r: - while attempts <= 5: + while attempts <= 3: try: r.raise_for_status() break except Exception: - click.echo(f"Download attempt failed: HTTP {r.status_code}; retrying {attempts}/5") + click.echo(f"Download attempt failed: HTTP {r.status_code}; retrying {attempts}/3") sleep(attempts) attempts += 1 if r is None or r.status_code != 200: