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 315 forks source link

Consistent 400 Error after updating to poe-api 0.4.13 #188

Closed neekohuncho closed 1 year ago

neekohuncho commented 1 year ago

python3 examples/temporary_message.py "XXXXXXXXXXXXXXXX"

INFO:root:Setting up session... INFO:root:Downloading next_data... INFO:root:Downloading channel data... INFO:root:Downloading all bots... INFO:root:Subscribing to mutations WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (1/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (2/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (3/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (4/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (5/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (6/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (7/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (8/10)... WARNING:root:Server returned a status code of 400 while downloading https://poe.com/api/gql_POST. Retrying (9/10)... 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 "/Users/neeko/Downloads/poe-api-main-5/examples/temporary_message.py", line 9, in client = poe.Client(token) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poe.py", line 153, in init self.connect_ws() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poe.py", line 403, in connect_ws self.setup_connection() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poe.py", line 195, in setup_connection self.subscribe() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poe.py", line 361, in subscribe result = self.send_query("SubscriptionsMutation", { File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poe.py", line 348, in send_query r = request_with_retries(self.session.post, self.gql_url, data=payload, headers=headers) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poe.py", line 83, in request_with_retries raise RuntimeError(f"Failed to download {url} too many times.") RuntimeError: Failed to download https://poe.com/api/gql_POST too many times.

ading2210 commented 1 year ago

Looks like Poe started to enforce hashes on the gql_POST requests.

claell commented 1 year ago

Wow, Poe recently seem to break a lot. Let's hope, we can get into a more usable state soon.

ading2210 commented 1 year ago

Looks like Poe started to enforce hashes on the gql_POST requests.

On second thought, I don't think this is the case. Perhaps they changed the algorithm for poe-tag-id again.

siriani commented 1 year ago

I tried to check, and indeed the package broke. Something must have changed on poe.com

xieqing520 commented 1 year ago

the formKey is error , because it check the quickJs.

xieqing520 commented 1 year ago

this line is check the quickjs,when find it return error form key image

xieqing520 commented 1 year ago

if (!window || !window['docu' + 'ment'] || !window[_0x4eeb76(0x1a9) + 'gato' + 'r'] || typeof process !== 'unde' + _0x4eeb76(0x199) + 'd' || typeof QuickJS !== 'unde' + _0x4eeb76(0x199) + 'd' || !window[_0x4eeb76(0x174) + 'nI8q' + 'sQ']) return _0x477aff;

xieqing520 commented 1 year ago

add this init code,while return ture form key: var window = { 'document':{ "aaaa":"" }, 'navigator':"aaaaaaa", 'xjCOnI8qsQ':true }; var process = undefined var QuickJS = undefined

wong2 commented 1 year ago

Wow the QuickJS check makes me suspect that someone at Poe is watching this repo.

ading2210 commented 1 year ago

I was looking at this a few hours ago, and I believe that they also changed the algorithm for generating poe-tag-id, although I haven't yet figured out exactly how it works.

wong2 commented 1 year ago

I don't think poe-tag-id algorithm changed, because after bypassing the document, navigator, ... checks, my project works fine now.

ading2210 commented 1 year ago

add this init code,while return ture form key: var window = { 'document':{ "aaaa":"" }, 'navigator':"aaaaaaa", 'xjCOnI8qsQ':true }; var process = undefined var QuickJS = undefined @xieqing520

This isn't enough to stop Poe from denying the requests. The poe-tag-id header needs to be reverse engineered again.

canxin121 commented 1 year ago

add this init code,while return ture form key: var window = { 'document':{ "aaaa":"" }, 'navigator':"aaaaaaa", 'xjCOnI8qsQ':true }; var process = undefined var QuickJS = undefined @xieqing520

This isn't enough to stop Poe from denying the requests. The poe-tag-id header needs to be reverse engineered again.

i only changed the form key in my async poe client, and i just passed all the pytests.

ading2210 commented 1 year ago

This has been fixed in version 0.4.15.

xieqing520 commented 1 year ago

i sure Poe is watching this repo. i sleep 2hour, get new error

dalaolala commented 1 year ago

add this init code,while return ture form key: var window = { 'document':{ "aaaa":"" }, 'navigator':"aaaaaaa", 'xjCOnI8qsQ':true }; var process = undefined var QuickJS = undefined @xieqing520

This isn't enough to stop Poe from denying the requests. The poe-tag-id header needs to be reverse engineered again.

i only changed the form key in my async poe client, and i just passed all the pytests.

Yes, if you write your own form key directly in poe.py, can use it

akl7777777 commented 1 year ago

must add "extensions": { "hash": "5fd489242adf25bf399a95c6b16de9665e521b76618a97621167ae5e11e4bce4" }