ading2210 / poe-api

[UNMAINTAINED] A reverse engineered Python API wrapper for Quora's Poe, which provides free access to ChatGPT, GPT-4, and Claude.
https://pypi.org/project/poe-api
GNU General Public License v3.0
2.5k stars 313 forks source link

Server returned a status code of 400 while downloading https://poe.com/api/gql_POST #230

Open ading2210 opened 1 year ago

ading2210 commented 1 year ago
(.venv) allen@dedipath-instance-1:~/projects/poe-api$ python3 examples/temporary_message.py "xxxxxxxxxxxxxxxxxxxx%3D%3D"
INFO:root:Setting up session...
INFO:root:Downloading next_data...
INFO:httpx:HTTP Request: GET https://poe.com "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://psc2.cf2.poecdn.net/7f2217bbcdbfed56b253b36c7dba078a36090fad/_next/static/chunks/pages/_app-e27ceba2530b4b53.js "HTTP/1.1 200 OK"
INFO:root:Downloading channel data...
INFO:httpx:HTTP Request: GET https://poe.com/api/settings "HTTP/1.1 200 OK"
INFO:root:Downloading all bots...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (1/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (2/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (3/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (4/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (5/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (6/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (7/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (8/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (9/10)...
INFO:httpx:HTTP Request: POST https://poe.com/api/gql_POST "HTTP/1.1 400 Bad Request"
WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (10/10)...
Traceback (most recent call last):
  File "/home/allen/projects/poe-api/examples/temporary_message.py", line 9, in <module>
    client = poe.Client(token)
             ^^^^^^^^^^^^^^^^^
  File "/home/allen/projects/poe-api/src/poe/__init__.py", line 155, in __init__
    self.connect_ws()
  File "/home/allen/projects/poe-api/src/poe/__init__.py", line 448, in connect_ws
    self.setup_connection()
  File "/home/allen/projects/poe-api/src/poe/__init__.py", line 196, in setup_connection
    self.bots = self.get_bots(download_next_data=False)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allen/projects/poe-api/src/poe/__init__.py", line 282, in get_bots
    bot_list_data = self.send_query("BotSwitcherModalQuery", {})["data"]["viewer"]["availableBotsConnection"]
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allen/projects/poe-api/src/poe/__init__.py", line 391, in send_query
    r = request_with_retries(self.session.post, self.gql_url, data=payload, headers=headers)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allen/projects/poe-api/src/poe/__init__.py", line 83, in request_with_retries
    raise RuntimeError(f"Failed to download {url} too many times.")

227 was fixed, although a new issue comes up.

ghost-in-a-shell commented 1 year ago

Maybe poe has changed the headers and payload format yesterday.

MujtabaMohsin commented 1 year ago

This project is not working anymore.

AhmedWaleed45 commented 1 year ago

Same here but I had this error even before the update

Nox998464 commented 1 year ago

I think poe is blocking requests sent to https://poe.com/api/gql_POST. May be we can make a workaround through https://www.quora.com/poe_api/gql_POST ? I found this one helpful with that implement: https://github.com/snowby666/poe-api-wrapper

AhmedWaleed45 commented 1 year ago

@Nox998464 So did the wrapper work with you or not?

Nox998464 commented 1 year ago

@Nox998464 So did the wrapper work with you or not?

Yeh, the wrapper runs smoothly for me. But Im still waiting for the async update of it

AhmedWaleed45 commented 1 year ago

@Nox998464 So did the wrapper work with you or not?

Yeh, the wrapper runs smoothly for me. But Im still waiting for the async update of it

great thanks for the advice I will try

win4r commented 11 months ago

最新AI集成软件-AI超元域:https://github.com/win4r/AISuperDomain