labteral / chatgpt-python

Unofficial Python SDK for OpenAI's ChatGPT
https://labteral.github.io/chatgpt-python/
GNU General Public License v3.0
523 stars 76 forks source link

chatgpt.errors.ChatgptError: Login error. Try again or use interceptor.js as explained in the documentation. #28

Open Kuduxaaa opened 1 year ago

Kuduxaaa commented 1 year ago

i have this error chatgpt.errors.ChatgptError: Login error. Try again or use interceptor.js as explained in the documentation. when i run the script

whyakari commented 1 year ago

i have this error chatgpt.errors.ChatgptError: Login error. Try again or use interceptor.js as explained in the documentation. when i run the script

me too

danielcerk commented 1 year ago

i have this error chatgpt.errors.ChatgptError: Login error. Try again or use interceptor.js as explained in the documentation. when i run the script

The error is caused due to OpenAI login update process

hardik-goel commented 1 year ago

@dcgo15 could you please explain more on this? Do we have a workaround to establish a login connection?

BlitzJB commented 1 year ago

+1

Karlheinzniebuhr commented 1 year ago

My login error

The above exception was the direct cause of the following exception:

ChatgptError                              Traceback (most recent call last)
File c:\ProgramData\Anaconda3\lib\site-packages\chatgpt\chatgpt.py:321, in Conversation.chat(self, message, retry_on_401, direct_response, stream)
    320 if self._access_token is None and self._email and self._password:
--> 321     self.login(self._email, self._password)
    323 if self._access_token is None:

File c:\ProgramData\Anaconda3\lib\site-packages\chatgpt\chatgpt.py:178, in Conversation.login(self, email, password)
    177 self._password = password
--> 178 session_info = self._openai_authentication.login(email, password)
    179 return self._process_chatgpt_session(session_info)

File c:\ProgramData\Anaconda3\lib\site-packages\chatgpt\authentication.py:156, in OpenAIAuthentication.login(self, username, password)
    155 except HTTPTLSError as err:
--> 156     raise ChatgptError("Login error. Try again or use interceptor.js as explained in the documentation.",
    157                        ChatgptErrorCodes.LOGIN_ERROR) from err

ChatgptError: Login error. Try again or use interceptor.js as explained in the documentation.

During handling of the above exception, another exception occurred:

ChatgptError                              Traceback (most recent call last)
c:\dev\DMonitor\openai.ipynb Cell 1 in <cell line: 9>()
      [6](vscode-notebook-cell:/c%3A/dev/DMonitor/openai.ipynb#W1sZmlsZQ%3D%3D?line=5) conversation = Conversation()
      [8](vscode-notebook-cell:/c%3A/dev/DMonitor/openai.ipynb#W1sZmlsZQ%3D%3D?line=7) # Stream the message as it arrives.
----> [9](vscode-notebook-cell:/c%3A/dev/DMonitor/openai.ipynb#W1sZmlsZQ%3D%3D?line=8) for chunk in conversation.stream("We are going to start a conversation. I will speak English and you will speak Portuguese."):
     [10](vscode-notebook-cell:/c%3A/dev/DMonitor/openai.ipynb#W1sZmlsZQ%3D%3D?line=9)     print(chunk, end="")
     [11](vscode-notebook-cell:/c%3A/dev/DMonitor/openai.ipynb#W1sZmlsZQ%3D%3D?line=10)     sys.stdout.flush()

File c:\ProgramData\Anaconda3\lib\site-packages\chatgpt\chatgpt.py:267, in Conversation.stream(self, message, retry_on_401, only_new_characters)
    265 stream_text_result = ""
    266 chunk_buffer = ""
--> 267 response = self.chat(message, retry_on_401, True, True)
    268 for chunk in response.iter_content(chunk_size=1024):
    269     chunk_buffer += chunk.decode("utf-8").replace("data: ", "")

File c:\ProgramData\Anaconda3\lib\site-packages\chatgpt\chatgpt.py:410, in Conversation.chat(self, message, retry_on_401, direct_response, stream)
    408         return self.chat(message, False, direct_response=direct_response, stream=stream)
    409     elif (exception_code == ChatgptErrorCodes.LOGIN_ERROR or exception_code == ChatgptErrorCodes.TIMEOUT_ERROR) and retry_on_401:
--> 410         return self.chat(message, False, direct_response=direct_response, stream=stream)
    412 except TLSClientExeption as ex:
    413     exception_message = str(ex)

File c:\ProgramData\Anaconda3\lib\site-packages\chatgpt\chatgpt.py:420, in Conversation.chat(self, message, retry_on_401, direct_response, stream)
    417     exception_message = str(e)
    418     exception_code = ChatgptErrorCodes.UNKNOWN_ERROR
--> 420 raise ChatgptError(
    421     exception_message, exception_code)

ChatgptError: Login error. Try again or use interceptor.js as explained in the documentation.
alexlaverty commented 1 year ago

I'm receiving the same error, is this due to the "I'm not a Robot" reCAPTCHA field on the ChatGPT login page?

volpatoo commented 1 year ago

Has someone fixed this issue?

skskcco2o17 commented 1 year ago

I got the workaround i.e. using access token instead of userid/pwd in config.json. Access token can be found from https://chat.openai.com/api/auth/session after login using uid/pwd & captcha in the same browser. But after that I got 403 error. Issue already raised : https://github.com/labteral/chatgpt-python/issues/30