You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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')
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.
The text was updated successfully, but these errors were encountered:
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')
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.
The text was updated successfully, but these errors were encountered: