snowby666 / poe-api-wrapper

👾 A Python API wrapper for Poe.com. With this, you will have free access to GPT-4, Claude, Llama, Gemini, Mistral and more! 🚀
https://pypi.org/project/poe-api-wrapper/
GNU General Public License v3.0
677 stars 81 forks source link

Rate Limit exceeded RuntimeError #162

Closed SolarDriftCom closed 2 weeks ago

SolarDriftCom commented 3 weeks ago

Hi,

I get this error no matter what I do once setup the client:

raise RuntimeError("Rate limit exceeded for sending requests to poe.com. Please try again later.") RuntimeError: Rate limit exceeded for sending requests to poe.com. Please try again later.

Any ideas? I am subscribed in Poe so any model should work? I tried GPT-4o, GPT-4o-128k, and GPT-3_5

Code:

from poe_api_wrapper import PoeApi

tokens = { # Copy the values of m-b and m-lat cookies AFTER LOGGING IN TO POE.COM 'b': '...', 'lat': '...', '__cf_bm': '...', 'cf_clearance': '...' } client = PoeApi(cookie=tokens) bot = "GPT-4o-128k"

file_urls = ["https://mypdffile.pdf"] # SWAP OUT FOR REAL FILE for chunk in client.send_message(bot, "Taking the attached document answer all of the following questions in JSON format:\nWhat is the customers full name and title in the attached document?\n", file_path=file_urls): print(chunk["response"], end="", flush=True)

I also cleared all cookies and logged in again to Poe.com to get new cookie values, but still same error.

Note it first shows a lot of purple output before the above error with HTML in it, and the Javascript error identified in issue #130

Thanks Paul

yuvenbn commented 2 weeks ago

I also got the Rate Limit Error on my first attempt when using the 'b' and 'lat' tokens I got from Poe.com. But when I used the tokens from Quora.com itself, it started working.

snowby666 commented 2 weeks ago

This is fixed in the v1.4.3. Please check documentation for new config.

SolarDriftCom commented 2 weeks ago

@snowby666 I installed the latest version 2 days ago using pip, and the error still exists? Can you let me know what I am doing wrong? Thanks

UPDATE: Apologies, I see you just recently updated the library, thanks

snowby666 commented 2 weeks ago

@snowby666 I installed the latest version 2 days ago using pip, and the error still exists? Can you let me know what I am doing wrong? Thanks

UPDATE: Apologies, I see you just recently updated the library, thanks

Keep me update if there is any error ^^

SolarDriftCom commented 2 weeks ago

OK

I have the value of this from Chrome:

2nd Method: Devtools > Console > Type: allow pasting > Paste this script: window.ereNdsRqhp2Rd3LEW()

Copy the result

I also have all these:

tokens = { 'p-b': 'p-b cookie here', 'p-lat': 'p-lat cookie here', 'formkey': 'formkey here', '__cf_bm': '__cf_bm cookie here', 'cf_clearance': 'cf_clearance cookie here' }

(Obviously with the correct values)

From poe.com

But get this:

Traceback (most recent call last): File "/var/www/readfile.ai/public_html/api/routes/test-poe-api/poeTest2.py", line 11, in client = PoeApi(tokens=tokens) File "/home/secureuser/miniconda3/lib/python3.10/site-packages/poe_api_wrapper/api.py", line 34, in init raise ValueError("Please provide valid p-b, p-lat and formkey") ValueError: Please provide valid p-b, p-lat and formkey

snowby666 commented 2 weeks ago

OK

I have the value of this from Chrome:

2nd Method: Devtools > Console > Type: allow pasting > Paste this script: window.ereNdsRqhp2Rd3LEW()

Copy the result

I also have all these:

tokens = { 'p-b': 'p-b cookie here', 'p-lat': 'p-lat cookie here', 'formkey': 'formkey here', '__cf_bm': '__cf_bm cookie here', 'cf_clearance': 'cf_clearance cookie here' }

(Obviously with the correct values)

From poe.com

But get this:

Traceback (most recent call last): File "/var/www/readfile.ai/public_html/api/routes/test-poe-api/poeTest2.py", line 11, in client = PoeApi(tokens=tokens) File "/home/secureuser/miniconda3/lib/python3.10/site-packages/poe_api_wrapper/api.py", line 34, in init raise ValueError("Please provide valid p-b, p-lat and formkey") ValueError: Please provide valid p-b, p-lat and formkey

please check your tokens again if you are missing "," or anything

SolarDriftCom commented 2 weeks ago

Not missing anything? See:

tokens = { # Copy the values of m-b and m-lat cookies AFTER LOGGING IN TO POE.COM 'b': 'Wkl5BTsMQTuwXiHR54e2Kg%3D', 'lat': 'tJlVQGYrHtLN0v53VDD7ud6x', 'formKey': 'bbd527e2e00cb1381b3ab613', '__cf_bm': '_5btmwPIYfuPHeSh0.WQwVwyahvWt1G.UMlqBL5FKjI-1718644023-1.0.1.1-WkytrqBKkRNN7z2DXh33xNSnz0QBeZNpI1h4Xxff.iJREg3sRzkIIX', 'cfclearance': '0JmfJ9a1PpRBPTy.bmXeKDIYE4v1GZRDjzDcBLPYGnw-1718644024-1.0.1.1-FwPORPEd1.LpcypYAb0IDturJM5wmPdX4lBKySC8eStsl2vKc75n***' }

client = PoeApi(tokens=tokens) bot = "GPT-4o-128k"

file_urls = ["https://readfileaiprocessed.pdf"] for chunk in client.send_message(bot, "Taking the attached document answer all of the following questions in JSON format:\nWhat is the customers full name and title in the attached document?\n", file_path=file_urls): print(chunk["response"], end="", flush=True)

Same error? I am desperate to get this working. Currently I am manually processing 1000 documents a day :-)

snowby666 commented 2 weeks ago

I've just changed the config for client. They should be "p-b" and "p-lat" not "b" and "lat". Theres a typo for formkey with "K" instead of "k" btw ^^

SolarDriftCom commented 2 weeks ago

Ok thanks, that seems to have got me a bit further. But I now get this:

File "/home/secureuser/miniconda3/lib/python3.10/site-packages/poe_api_wrapper/api.py", line 654, in send_message message_data = self.send_request(apiPath, 'SendMessageMutation', variables, file_form) File "/home/secureuser/miniconda3/lib/python3.10/site-packages/poe_api_wrapper/api.py", line 117, in send_request "poe-tag-id": hashlib.md5((payload + self.formkey + "4LxgHM6KpFqokX0Ox").encode()).hexdigest(), TypeError: can't concat str to bytes

Thanks Paul

snowby666 commented 2 weeks ago

Theres a patch for uploading file now in v1.4.5

SolarDriftCom commented 2 weeks ago

Ok, any documentation for the patch? I can only see tags up to v1.4.3? Thanks

snowby666 commented 2 weeks ago

just update the lib and it should work now

SolarDriftCom commented 2 weeks ago

OK :-)

SolarDriftCom commented 2 weeks ago

Honestly your a genius and a legend! Thank you so much :-) Now my wrists and hands can remain intact from processing manually so much.

snowby666 commented 2 weeks ago

Glad it helps :D

snowby666 commented 2 weeks ago

I'm closing this issue now.