summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/bing
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-17 22:37:47 +0100
committerGitHub <noreply@github.com>2024-02-17 22:37:47 +0100
commitfe9f6d98064219ee5a791b9c9fa19b6526b54f41 (patch)
tree9584913c9e0b6930eed30928faa67173fdfcd8ec /g4f/Provider/bing
parentMerge pull request #1586 from nullstreak/temperature (diff)
parentImprove create conversation in Bing (diff)
downloadgpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.tar
gpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.tar.gz
gpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.tar.bz2
gpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.tar.lz
gpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.tar.xz
gpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.tar.zst
gpt4free-fe9f6d98064219ee5a791b9c9fa19b6526b54f41.zip
Diffstat (limited to 'g4f/Provider/bing')
-rw-r--r--g4f/Provider/bing/conversation.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/g4f/Provider/bing/conversation.py b/g4f/Provider/bing/conversation.py
index 388bdd6b..fb95e241 100644
--- a/g4f/Provider/bing/conversation.py
+++ b/g4f/Provider/bing/conversation.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import uuid
from aiohttp import ClientSession
class Conversation:
@@ -30,8 +31,20 @@ async def create_conversation(session: ClientSession, proxy: str = None) -> Conv
Returns:
Conversation: An instance representing the created conversation.
"""
- url = 'https://www.bing.com/turing/conversation/create?bundleVersion=1.1199.4'
+ url = 'https://www.bing.com/search?toncp=0&FORM=hpcodx&q=Bing+AI&showconv=1&cc=en'
async with session.get(url, proxy=proxy) as response:
+ response.raise_for_status()
+ headers = {
+ "accept": "application/json",
+ "sec-fetch-dest": "empty",
+ "sec-fetch-mode": "cors",
+ "sec-fetch-site": "same-origin",
+ "x-ms-client-request-id": str(uuid.uuid4()),
+ "x-ms-useragent": "azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.12.3 OS/Windows",
+ "referer": url
+ }
+ url = 'https://www.bing.com/turing/conversation/create?bundleVersion=1.1579.2'
+ async with session.get(url, headers=headers, proxy=proxy) as response:
try:
data = await response.json()
except: