diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-19 18:59:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 18:59:42 +0100 |
commit | 79bc56f36e02a3ccb82c92af58363836ab2affb2 (patch) | |
tree | 60b32a4cae7f2921ddbb4e77560ac761164989ca /g4f/Provider/bing/conversation.py | |
parent | ~ | include /local/models dir on pip (diff) | |
parent | Fix Bing key error (diff) | |
download | gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.tar gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.tar.gz gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.tar.bz2 gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.tar.lz gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.tar.xz gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.tar.zst gpt4free-79bc56f36e02a3ccb82c92af58363836ab2affb2.zip |
Diffstat (limited to 'g4f/Provider/bing/conversation.py')
-rw-r--r-- | g4f/Provider/bing/conversation.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/g4f/Provider/bing/conversation.py b/g4f/Provider/bing/conversation.py index 886efa68..de5716b7 100644 --- a/g4f/Provider/bing/conversation.py +++ b/g4f/Provider/bing/conversation.py @@ -2,6 +2,7 @@ from __future__ import annotations from aiohttp import ClientSession from ...requests import raise_for_status +from ...errors import RateLimitError class Conversation: """ @@ -36,6 +37,8 @@ async def create_conversation(session: ClientSession, headers: dict, tone: str) else: url = "https://www.bing.com/turing/conversation/create?bundleVersion=1.1626.1" async with session.get(url, headers=headers) as response: + if response.status == 404: + raise RateLimitError("Response 404: Do less requests and reuse conversations") await raise_for_status(response, "Failed to create conversation") data = await response.json() conversationId = data.get('conversationId') |