fix: music_with_retry need only userId params.
This commit is contained in:
parent
bfa29f669f
commit
cf4fa84616
13
mapstock.py
13
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())
|
||||
|
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user