Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweep: Error when getting JSON response from Bing server #21

Open
CmetankaJDD opened this issue Jan 8, 2024 · 1 comment
Open

Sweep: Error when getting JSON response from Bing server #21

CmetankaJDD opened this issue Jan 8, 2024 · 1 comment
Labels
sweep Assigns Sweep to an issue or pull request.

Comments

@CmetankaJDD
Copy link

CmetankaJDD commented Jan 8, 2024

Details

When trying to create a conversation with Bing using Python and aiohttp, a ContentTypeError exception is raised. The Bing server returns an HTML page instead of a JSON response. This may be related to an incorrect URL or a problem on the server side. Reproducing the error:

Traceback (most recent call last):
File "C:\Users\Den\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\client\updates.py", line 570, in dispatch_update
await callback(event)
File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\main.py", line 212, in handler
result = await AiAgent(prompt, system_prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\main.py", line 44, in AiAgent
async for message in req:
File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\bing_init
.py", line 443, in stream_generate
conversation = await create_conversation(session, tone, image, proxy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\bing_init_.py", line 73, in create_conversation
data = await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Den\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\client_reqrep.py", line 1104, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://www.bing.com/turing/conversation/create?bundleVersion=1.1199.4')

  1. Run the script main.py from the repository https://github.com/username/Telegram-Chatbot-Gpt4Free
  2. Send a message to the bot in Telegram
  3. Get an error in the console

Expected result: The script gets a JSON response from the Bing server and generates a reply message for the bot in Telegram.
Actual result: The script throws a ContentTypeError exception and cannot continue working.

@CmetankaJDD CmetankaJDD added the sweep Assigns Sweep to an issue or pull request. label Jan 8, 2024
@Vladimirkkkk
Copy link

Im started this bot

Console - erorr:

raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 200, message='Invalid response status', url=URL('wss://sydney.bing.com/sydney/ChatHub?sec_access_token

What ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

No branches or pull requests

2 participants