Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

[BUG]raise Exception("Wrong response code") #273

Closed
Longyichen opened this issue Dec 12, 2022 · 4 comments
Closed

[BUG]raise Exception("Wrong response code") #273

Longyichen opened this issue Dec 12, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Longyichen
Copy link

Describe the bug
I'm getting this error using chatbot on the server.
I confirmed that the sessionid etc I provided is correct as I don't get the error when running it on my own mac computer. And I'm configuring the same config file for them.

To Reproduce
``
from revChatGPT.revChatGPT import AsyncChatbot as Chatbot
import json

async def handle_response(prompt) -> str:
chatbot.refresh_session()
response = await chatbot.get_chat_response(prompt, output="text")
responseMessage = response['message']

return responseMessage

def get_config() -> dict:
import os
# get config.json path
config_dir = os.path.abspath(file + "/../../")
config_name = 'config.json'
config_path = os.path.join(config_dir, config_name)

with open(config_path, 'r') as f:
    data = json.load(f)

return data

data = get_config()

config = {
"cf_clearance": data['cf_clearance'],
"user_agent": data['user_agent'],
"session_token" : data['session_token']
}

chatbot = Chatbot(config, conversation_id=None)
``

Expected behavior
Normal connection establishment

Output
Traceback (most recent call last):
File "/root/chatGPT-discord-bot/onmessage.py", line 3, in
from src import responses
File "/root/chatGPT-discord-bot/src/responses.py", line 34, in
chatbot = Chatbot(config, conversation_id=None)
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 96, in init
self.refresh_session()
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 308, in refresh_session
raise Exception("Wrong response code")
Exception: Wrong response code

@Longyichen Longyichen added the bug Something isn't working label Dec 12, 2022
@cibernicola
Copy link

cibernicola commented Dec 12, 2022

403 response code. Together with the fact that chat.openai.com is now "behind" CloudFlare, I dare say that it has CloudFlare's bot detector enabled, which means that the request headers will have to be better worked on.

Edit:
Tested: 403 error bypased with another UA. Hint: UA random generator.

Re-Edit:
Nope, UA randomizer not working :(. Code 403

@acheong08
Copy link
Owner

Closing in favor of #261

Fixed by https://github.com/acheong08/ChatGPT/releases/tag/0.0.a40

@cibernicola
Copy link

not working:
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service C:\Users\*******\appdata\roaming\undetected_chromedriver\e0609fc12f4117e7_chromedriver.exe

It doesn't "move" from wlcome screen
image

@acheong08
Copy link
Owner

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants