From 68c0e28fbd1b6048bfdb9b25805f9bd944d5b1f2 Mon Sep 17 00:00:00 2001 From: scrpr <46473171+scrpr@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:49:17 +0800 Subject: [PATCH] sleep 0.5s --- utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils.py b/utils.py index dc3c853..d264034 100644 --- a/utils.py +++ b/utils.py @@ -7,6 +7,7 @@ import requests from requests.exceptions import RequestException from requests.adapters import HTTPAdapter, Retry +import time def cleanup_ass_file(input_file, output_file): with open(input_file, encoding='utf-8-sig', mode='r') as f: @@ -38,6 +39,7 @@ def traditionalize_text(input_text, user_pre_replace="", user_protect_replace="" response.raise_for_status() result = response.json() if "data" in result and "text" in result["data"]: + time.sleep(0.5) return result["data"]["text"] else: raise Exception("Error: Unexpected response format")