rogerxavier
commited on
Commit
•
0de437b
1
Parent(s):
523d3b6
Update api.py
Browse files
api.py
CHANGED
@@ -160,17 +160,17 @@ async def upload_video(meta:dict):
|
|
160 |
#假设最多重新上传5次,上传cover超时那么选取随机图片重新作为cover上传
|
161 |
max_attempts = 5
|
162 |
attempts = 0
|
163 |
-
while attempts < max_attempts:
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
|
175 |
|
176 |
|
|
|
160 |
#假设最多重新上传5次,上传cover超时那么选取随机图片重新作为cover上传
|
161 |
max_attempts = 5
|
162 |
attempts = 0
|
163 |
+
while attempts < max_attempts:
|
164 |
+
try:
|
165 |
+
await upload_with_random_cover(meta);
|
166 |
+
except Exception as e:
|
167 |
+
print("上传video遇到错误,可能是cover不符合超时,下面将调用upload_with_random_cover函数")
|
168 |
+
print(f"Attempt 第{attempts+1}次重新上传: 本次错误原因是Error : {e}")
|
169 |
+
#重新上传会执行try的部分,所以except部分不用写upload again
|
170 |
+
attempts += 1
|
171 |
+
else:
|
172 |
+
print("No errors occurred")
|
173 |
+
break
|
174 |
|
175 |
|
176 |
|