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

403 Client Error #30

Open salsasteve opened 1 year ago

salsasteve commented 1 year ago

I think they are removing or changing the endpoint location.

appuser@adab2bb37b36:/workspaces/gottithebot$ python -m chatgpt
> Write a blog about Augmented Reality for a 7 year old
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/chatgpt/chatgpt.py", line 352, in chat
    response = self._session.request(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/chatgpt/sessions.py", line 84, in request
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://chat.openai.com/backend-api/conversation

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/local/lib/python3.11/site-packages/chatgpt/__main__.py", line 30, in <module>
    main()
  File "/usr/local/lib/python3.11/site-packages/chatgpt/__main__.py", line 26, in main
    print(conversation.chat(message), end='\n\n')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/chatgpt/chatgpt.py", line 383, in chat
    exception_message = str(reason).split(
                        ^^^^^^^^^^^^^^^^^^
IndexError: list index out of range
y2k04 commented 1 year ago

Same

skskcco2o17 commented 1 year ago

I am facing the same problem.

Traceback (most recent call last): File "C:\Users\XXX\Anaconda3\lib\site-packages\chatgpt\chatgpt.py", line 352, in chat response = self._session.request( File "C:\Users\XXX\Anaconda3\lib\site-packages\chatgpt\sessions.py", line 84, in request response.raise_for_status() File "C:\Users\XXX\Anaconda3\lib\site-packages\requests\models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://chat.openai.com/backend-api/conversation

During handling of the above exception, another exception occurred:

Traceback (most recent call last): for chunk in conversation.stream("."): File "C:\Users\XXX\Anaconda3\lib\site-packages\chatgpt\chatgpt.py", line 267, in stream response = self.chat(message, retry_on_401, True, True) File "C:\Users\XXX\Anaconda3\lib\site-packages\chatgpt\chatgpt.py", line 383, in chat exception_message = str(reason).split( IndexError: list index out of range

y2k04 commented 1 year ago

I gave up trying for the moment and moved onto the unofficial ChatGPT app by lencx.