发帖增加重试
This commit is contained in:
@@ -450,6 +450,11 @@ def retry_get_new_video(page, cookies, post_count):
|
|||||||
raise TimeoutError("未获取到新视频(可能视频上传失败),已超时")
|
raise TimeoutError("未获取到新视频(可能视频上传失败),已超时")
|
||||||
|
|
||||||
|
|
||||||
|
@retry(
|
||||||
|
stop=stop_after_attempt(3),
|
||||||
|
wait=wait_fixed(2),
|
||||||
|
retry=retry_if_exception(is_operation_failed)
|
||||||
|
)
|
||||||
def playwright_post(cookies, content, image_key=None):
|
def playwright_post(cookies, content, image_key=None):
|
||||||
path = os.path.join(BASE_PATH, 'chrome', '130-0008', 'chrome.exe')
|
path = os.path.join(BASE_PATH, 'chrome', '130-0008', 'chrome.exe')
|
||||||
with lock:
|
with lock:
|
||||||
@@ -483,8 +488,7 @@ def playwright_post(cookies, content, image_key=None):
|
|||||||
client.fget_object(BUCKET, image_key, file_path)
|
client.fget_object(BUCKET, image_key, file_path)
|
||||||
|
|
||||||
sleep(1, 2)
|
sleep(1, 2)
|
||||||
page.locator('input[accept="image/*,image/heif,image/heic,video/*,video/mp4,video/x-m4v,'
|
page.locator('input[accept="image/*,image/heif,image/heic,video/*,video/mp4,video/x-m4v,video/x-matroska,.mkv"]').set_input_files(file_path)
|
||||||
'video/x-matroska,.mkv"]').set_input_files(file_path)
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
if not image_key:
|
if not image_key:
|
||||||
|
|||||||
Reference in New Issue
Block a user