From cf4fa846160ce77501a4a148b466edc61b0354aa Mon Sep 17 00:00:00 2001 From: 7a1dd609-d238-4580-9d5f-ee8412b0f5bc <7a1dd609-d238-4580-9d5f-ee8412b0f5bc@bankofchina.com> Date: Sat, 11 Jan 2025 02:00:31 +0800 Subject: [PATCH] fix: music_with_retry need only userId params. --- mapstock.py | 13 ++++++------- unlock_all.py | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mapstock.py b/mapstock.py index 892b0a0..7428f16 100644 --- a/mapstock.py +++ b/mapstock.py @@ -384,16 +384,15 @@ def music(userId): userall_result = json.loads(sdgb_api(data, "UpsertUserAllApi", userId)) return userall_result -def music_with_retry(userId, max_retries=10): # 这里是重试次数 - for i in range(max_retries): +def music_with_retry(userId): + for i in range(5): # 重试次数 try: - print(music(userId)) + music(userId) return logout(userId, timestamp) except ValueError as e: - print(f"尝试 {i+1} 失败,错误:{e}") - print(logout(userId, timestamp)) - time.sleep(5) # 等待 5 秒后重试 - return "重试次数超过限制,乐曲上传失败" + logout(userId, timestamp) + time.sleep(3) # 等待 5 秒后重试 + return "Error" if __name__ == "__main__": print(music_with_retry()) diff --git a/unlock_all.py b/unlock_all.py index 291a1a5..92c1c39 100644 --- a/unlock_all.py +++ b/unlock_all.py @@ -7501,16 +7501,15 @@ def music(userId): userall_result = json.loads(sdgb_api(data, "UpsertUserAllApi", userId)) return userall_result -def music_with_retry(userId, max_retries=10): # 这里是重试次数 - for i in range(max_retries): +def music_with_retry(userId): + for i in range(5): # 重试次数 try: - print(music(userId)) + music(userId) return logout(userId, timestamp) except ValueError as e: - print(f"尝试 {i+1} 失败,错误:{e}") - print(logout(userId, timestamp)) - time.sleep(5) # 等待 5 秒后重试 - return "重试次数超过限制,乐曲上传失败" + logout(userId, timestamp) + time.sleep(3) # 等待 5 秒后重试 + return "Error" if __name__ == "__main__": print(music_with_retry())