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
687 stars 82 forks source link

RuntimeError: Rate limit exceeded for sending requests to poe.com. Please try again later. #76

Closed changwu closed 7 months ago

changwu commented 8 months ago

Hi, thanks for your great code:

from poe_api_wrapper import PoeApi
client = PoeApi("ytPDdfNE4UNar6RHT72-TQ==")

# Using Client with proxy (default is False)
client = PoeApi("ytPDdfNE4UNar6RHT72-TQ==", proxy=False)

# Get chat data of all bots (this will fetch all available threads)
print(client.get_chat_history()['data'])
# >> Output:
# {'chinchilla': [{'chatId': 74397929, 'chatCode': '2ith0h11zfyvsta1u3z', 'id': 'Q2hhdDo3NDM5NzkyOQ==', 'title': 'Comparison'}], 'code_llama_7b_instruct': [{'chatId': 74397392, 'chatCode': '2ithbduzsysy3g178hb', 'id': 'Q2hhdDo3NDM5NzM5Mg==', 'title': 'Decent Programmers'}], 'a2': [{'chatId': 74396838, 'chatCode': '2ith9nikybn4ksn51l8', 'id': 'Q2hhdDo3NDM5NjgzOA==', 'title': 'Reverse Engineering'}, {'chatId': 74396452, 'chatCode': '2ith79n4x0p0p8w5yue', 'id': 'Q2hhdDo3NDM5NjQ1Mg==', 'title': 'Clean Code'}], 'leocooks': [{'chatId': 74396246, 'chatCode': '2ith82wj0tjrggj46no', 'id': 'Q2hhdDo3NDM5NjI0Ng==', 'title': 'Pizza perfection'}], 'capybara': [{'chatId': 74396020, 'chatCode': '2ith5o3p8c5ajkdwd3k', 'id': 'Q2hhdDo3NDM5NjAyMA==', 'title': 'Greeting'}]}

# # Get chat data of a bot (this will fetch all available threads)
# print(client.get_chat_history("a2")['data'])
# >> Output:
# {'a2': [{'chatId': 74396838, 'chatCode': '2ith9nikybn4ksn51l8', 'id': 'Q2hhdDo3NDM5NjgzOA==', 'title': 'Reverse Engineering'}, {'chatId': 74396452, 'chatCode': '2ith79n4x0p0p8w5yue', 'id': 'Q2hhdDo3NDM5NjQ1Mg==', 'title': 'Clean Code'}]}

# Get a defined number of most recent chat threads (using count param will ignore interval param)
# Fetching all bots
print(client.get_chat_history(count=20)['data'])
# Fetching 1 bot
print(client.get_chat_history(bot="a2", count=20)['data'])

# You can pass the number of bots fetched for each interval to both functions. (default is 50)
# Fetching 200 chat threads of all bots each interval
print(client.get_chat_history(interval=200)['data'])
# Fetching 200 chat threads of a bot each interval
print(client.get_chat_history(bot="a2", interval=200)['data'])

# Pagination Example:
# Fetch the first 20 chat threads
history = client.get_chat_history(count=20)
pages = [history['data']]
new_cursor = history['cursor']

# Set a while loop with a condition of your choice
while new_cursor != None:
    # Fetch the next 20 chat threads with new_cursor
    new_history = client.get_chat_history(count=20, cursor=new_cursor)
    # Append the next 20 chat threads 
    new_cursor = new_history['cursor']
    pages.append(new_history['data'])

# Print the pages (20 chat threads each page)
for page in range(len(pages)):
    print(f'This is page {page+1}')
    for bot, value in pages[page].items():
        for thread in value:
            print({bot: thread})

when run the code, the error as below:

Traceback (most recent call last):
  File ".\poe_suggest.py", line 4, in <module>
    client = PoeApi("ytPDdfNE4UNar6RHT72-TQ==")
  File "C:\ProgramData\Miniconda2\lib\site-packages\poe_api_wrapper\api.py", line 151, in __init__
    self.connect_ws()
  File "C:\ProgramData\Miniconda2\lib\site-packages\poe_api_wrapper\api.py", line 255, in connect_ws
    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.

How to fix it? Thanks.

AdeliManesh commented 7 months ago

Yes, I have the same problem.

It was working less than 11 hours ago, but suddenly went down. :(

V4ritas commented 7 months ago

I have the same problem.

No matter how I adjust it, it keeps throwing this RuntimeError.

snowby666 commented 7 months ago

Hi, This problem is due to some queries are outdated. I'll update the patch soon 🙌

mtoranzo commented 5 months ago

I have the same problem

mtoranzo commented 4 months ago

Any fix?

mtoranzo commented 4 months ago

Traceback (most recent call last): File "d:\REPOSITORIOS LOCALES\DEALER_HERMES\test.py", line 3, in PoeExample(token).chat_with_bot() ^^^^^^^^^^^^^^^^^ File "C:\Users\mtora\AppData\Local\Programs\Python\Python312\Lib\site-packages\poe_api_wrapper\example.py", line 24, in init self.client = PoeApi(cookie=self.cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mtora\AppData\Local\Programs\Python\Python312\Lib\site-packages\poe_api_wrapper\api.py", line 170, in init self.connect_ws() File "C:\Users\mtora\AppData\Local\Programs\Python\Python312\Lib\site-packages\poe_api_wrapper\api.py", line 294, in connect_ws 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.