poe-api icon indicating copy to clipboard operation
poe-api copied to clipboard

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

Open ading2210 opened this issue 1 year ago • 8 comments

(.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.

ading2210 avatar Aug 19 '23 06:08 ading2210

Maybe poe has changed the headers and payload format yesterday.

ghost-in-a-shell avatar Aug 19 '23 08:08 ghost-in-a-shell

This project is not working anymore.

MujtabaMohsin avatar Aug 19 '23 15:08 MujtabaMohsin

Same here but I had this error even before the update

AhmedWaleed45 avatar Aug 20 '23 01:08 AhmedWaleed45

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

Nox998464 avatar Aug 20 '23 03:08 Nox998464

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

AhmedWaleed45 avatar Aug 20 '23 09:08 AhmedWaleed45

@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

Nox998464 avatar Aug 20 '23 09:08 Nox998464

@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

AhmedWaleed45 avatar Aug 20 '23 10:08 AhmedWaleed45

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

win4r avatar Sep 01 '23 15:09 win4r