[X] I am sure the error is coming from Pyrogram's code and not elsewhere
[X] I have searched in the issue tracker for similar bug reports, including closed ones
[X] I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version
Description
I am downloading all the messages from a chat and i get this error. I think it's just missing an error handling on getSetoriesById
Steps to reproduce
I get this error using the get_chat_history method on a couple of chats. You can try on "BlogBeloso" to test this
Code example
from pyrogram import Client
app=Client(...)
with app:
c=app.get_chat("BlogBeloso")
for m in app.get_chat_history(c.id):
print(m)
Logs
Traceback (most recent call last):
File "/codedir/file1.py", line 79, in download_chat
) = await c.dump_all_messages_from_chat(
File "/codedir/file2.py", line 92, in dump_all_messages_from_chat
async for m in app.get_chat_history(target_id):
File "/envdir/lib/python3.10/site-packages/pyrogram/methods/messages/get_chat_history.py", line 111, in get_chat_history
messages = await get_chunk(
File "/envdir/lib/python3.10/site-packages/pyrogram/methods/messages/get_chat_history.py", line 51, in get_chunk
return await utils.parse_messages(client, messages, replies=0)
File "/envdir/lib/python3.10/site-packages/pyrogram/utils.py", line 111, in parse_messages
await types.Message._parse(
File "/envdir/lib/python3.10/site-packages/pyrogram/types/messages_and_media/message.py", line 931, in _parse
story = await client.get_stories(utils.get_peer_id(media.peer), media.id)
File "/envdir/lib/python3.10/site-packages/pyrogram/methods/stories/get_stories.py", line 63, in get_stories
r = await self.invoke(
File "/envdir/lib/python3.10/site-packages/pyrogram/methods/advanced/invoke.py", line 94, in invoke
r = await session.invoke(
File "/envdir/lib/python3.10/site-packages/pyrogram/session/session.py", line 399, in invoke
return await self.send(query, timeout=timeout)
File "/envdir/lib/python3.10/site-packages/pyrogram/session/session.py", line 367, in send
RPCError.raise_it(result, type(data))
File "/envdir/lib/python3.10/site-packages/pyrogram/errors/rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.flood_420.FloodWait: Telegram says: [420 FLOOD_WAIT_X] - A wait of 41 seconds is required (caused by "stories.GetStoriesByID")
Checklist
pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip
and reproduced the issue using the latest development versionDescription
I am downloading all the messages from a chat and i get this error. I think it's just missing an error handling on getSetoriesById
Steps to reproduce
I get this error using the get_chat_history method on a couple of chats. You can try on "BlogBeloso" to test this
Code example
Logs