From eceb2bfaaf0c778d7abca0f3593d24cb3c812b1e Mon Sep 17 00:00:00 2001 From: hibobmaster Date: Fri, 10 Mar 2023 08:27:48 +0800 Subject: [PATCH] Use asyncio.sleep instead of time.sleep --- ask_gpt.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ask_gpt.py b/ask_gpt.py index 9cb306e..e94b19a 100644 --- a/ask_gpt.py +++ b/ask_gpt.py @@ -4,7 +4,6 @@ api_endpoint from https://github.com/ayaka14732/ChatGPTAPIFree import aiohttp import asyncio import json -import time api_endpoint_free = "https://chatgpt-api.shn.hk/v1/" headers = {'Content-Type': "application/json"} @@ -29,7 +28,7 @@ async def ask(prompt: str) -> str: status_code = response.status if not status_code == 200: # wait 2s - time.sleep(2) + await asyncio.sleep(2) continue resp = await response.read()