forked from Fragrance/maquitous
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))
|
userall_result = json.loads(sdgb_api(data, "UpsertUserAllApi", userId))
|
||||||
return userall_result
|
return userall_result
|
||||||
|
|
||||||
def music_with_retry(userId, max_retries=10): # 这里是重试次数
|
def music_with_retry(userId):
|
||||||
for i in range(max_retries):
|
for i in range(5): # 重试次数
|
||||||
try:
|
try:
|
||||||
print(music(userId))
|
music(userId)
|
||||||
return logout(userId, timestamp)
|
return logout(userId, timestamp)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(f"尝试 {i+1} 失败,错误:{e}")
|
logout(userId, timestamp)
|
||||||
print(logout(userId, timestamp))
|
time.sleep(3) # 等待 5 秒后重试
|
||||||
time.sleep(5) # 等待 5 秒后重试
|
return "Error"
|
||||||
return "重试次数超过限制,乐曲上传失败"
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(music_with_retry())
|
print(music_with_retry())
|
||||||
|
@ -7501,16 +7501,15 @@ def music(userId):
|
|||||||
userall_result = json.loads(sdgb_api(data, "UpsertUserAllApi", userId))
|
userall_result = json.loads(sdgb_api(data, "UpsertUserAllApi", userId))
|
||||||
return userall_result
|
return userall_result
|
||||||
|
|
||||||
def music_with_retry(userId, max_retries=10): # 这里是重试次数
|
def music_with_retry(userId):
|
||||||
for i in range(max_retries):
|
for i in range(5): # 重试次数
|
||||||
try:
|
try:
|
||||||
print(music(userId))
|
music(userId)
|
||||||
return logout(userId, timestamp)
|
return logout(userId, timestamp)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(f"尝试 {i+1} 失败,错误:{e}")
|
logout(userId, timestamp)
|
||||||
print(logout(userId, timestamp))
|
time.sleep(3) # 等待 5 秒后重试
|
||||||
time.sleep(5) # 等待 5 秒后重试
|
return "Error"
|
||||||
return "重试次数超过限制,乐曲上传失败"
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(music_with_retry())
|
print(music_with_retry())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user