Repository: acheong08/ChatGPT

Issue #261: [BUG] Can't login | Cloudflare protection
Created: 2022-12-11T22:15:43Z
Describe the bug
I'm not able to login.
To Reproduce
Steps to reproduce the behavior:

Use the library as normal,  with email/password or session token.
If you are using email/password you'll get an API Error at start
If you are using a session token you'll get an Exception: Wrong response code at start

Expected behavior
Be able to access the website as normal.
Output
Using session token:
Traceback (most recent call last):
  File "/home/container/main.py", line 1, in <module>
    from src import bot
  File "/home/container/src/bot.py", line 3, in <module>
    from src import responses
  File "/home/container/src/responses.py", line 36, in <module>
    chatbot = Chatbot(config, conversation_id=None)
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 95, in __init__
    self.refresh_session()
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 296, in refresh_session
    raise Exception("Wrong response code")
Exception: Wrong response code

Using email/password:
Traceback (most recent call last):
  File "/home/container/main.py", line 1, in <module>
    from src import bot
  File "/home/container/src/bot.py", line 3, in <module>
    from src import responses
  File "/home/container/src/responses.py", line 36, in <module>
    chatbot = Chatbot(config, conversation_id=None)
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 95, in __init__
    self.refresh_session()
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 340, in refresh_session
    raise exc
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 337, in refresh_session
    self.login(self.config["email"], self.config["password"])
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 373, in login
    raise exc
  File "/home/container/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 366, in login
    auth.begin()
  File "/home/container/.local/lib/python3.10/site-packages/OpenAIAuth/OpenAIAuth.py", line 95, in begin
    raise Exception("API error")
Exception: API error

Environment (please complete the following information):
Please update your packages before reporting! pip3 install --upgrade OpenAIAuth revChatGPT

OS: Linux
Python version: 3.10.8
ChatGPT Version: 0.0.38.6
OpenAI Version: 0.0.6

Additional context
I saw that they applied Cloudflare on the website, and there are more cookies than before:

If I delete the cookie cf_clearance, the next time I reload the website I will get the Cloudflare is verifying your connection page, otherwise, it will not show.

Duplicate issue #241: __get_chat_text [BUG]
Created: 2022-12-11T08:33:22Z
Describe the bug
In the latest version, there seems to be a problem getting replies (pip3 install revChatGPT --upgrade)
This error is not present in 0.0.34.2
Error handling request
Traceback (most recent call last):
File "E:\Python 3.9\lib\site-packages\aiohttp\web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "E:\Python 3.9\lib\site-packages\aiohttp\web_app.py", line 504, in _handle
resp = await handler(request)
File "F:\Sosarciel\Sosarciel-GPT-HttpRobot\PyChatGPT-http\main.py", line 196, in handle_request
resp = await chat_server.send_thread_message(tid,msg)
File "F:\Sosarciel\Sosarciel-GPT-HttpRobot\PyChatGPT-http\main.py", line 85, in send_thread_message
resp =  await self.send_message(text,"text",tdata["conversation_id"],tdata["parent_id"])
File "F:\Sosarciel\Sosarciel-GPT-HttpRobot\PyChatGPT-http\main.py", line 73, in send_message
return await self.main_chat._AsyncChatBot__get_chat_text(data)
File "E:\Python 3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 452, in _get_chat_text
if 'detail' in response.json().keys():
File "E:\Python 3.9\lib\site-packages\httpx_models.py", line 752, in json
return jsonlib.loads(self.text, **kwargs)
File "E:\Python 3.9\lib\json_init.py", line 346, in loads
return _default_decoder.decode(s)
File "E:\Python 3.9\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "E:\Python 3.9\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Closing comment (2022-12-12T01:18:55Z): related to #261