Comments (10)
By reading the documentation: https://docs.pyrogram.ml/resources/ErrorHandling/
from pyrogram.
Thanks, I read documents,
but program wait on client.start() line, without any Exception.
try:
if self.__client is not None:
data['result'] = True
else:
session_path = self.__get_session_path()
self.__client = Client(session_name=session_path,
phone_number=str(self.__id),
phone_code=phone_code_callback,
password=self.__password)
self.__client.start()
me = self.__client.get_me()
if hasattr(me, 'ID'):
self.__client_id = me.ID
data['result'] = True
except FloodWait as ex:
data['error'] = BadRequest.__name__
data['error_log'] = ex
pass
from pyrogram.
try:
... # Any interaction with the API
except FloodWait as e:
time.sleep(e.x) # e.x contains the amount of seconds you have to wait
from pyrogram.
Yes, But "except FloodWait as e:" not called.
Please see video.
2018-02-01_19-24-00.zip
from pyrogram.
Ok the video makes it clear now.
Your except FloodWait as e
is not "called" because Pyrogram is blocking automatically; it waits there for 71819 seconds and then automatically tries again to login.
from pyrogram.
Can i handle blocking? when see this state, stop client and close program such as sys.exit()
from pyrogram.
Sure, you are free to fork and make changes to the code.
from pyrogram.
Thanks, i changed it.
I have suggestion, add callback to handle this state to future releases.
from pyrogram.
I have a client that has almost 500 group chats and about 3000 personal chats, I always get Floodwait because of get_dialogs when i call client.start() so I skipped this function during starting a client.
do you suggest any another solutions?
from pyrogram.
@i-Naji I've wrapped the relevant method around a try..catch block. Now it is sleeping X seconds before continuing fetching the dialogs. Please try again using the master branch.
This is not a definitive solution, I'm planning in caching all the dialogs in the session file in order to speed the lib up.
from pyrogram.
Related Issues (20)
- Обновить
- ОБНОВИТЬ ПАКЕТ СУКА!!!!!!!!!!!!!!!
- ГДЕ ЁБАНЫЕ ОБНОВЛЕНИЯ????????
- Your library is the BEST!
- Which is the Best Fork of Pyrogram? HOT 9
- Message missing text HOT 5
- Fix: Smart-plugin not supporting an off-drive path
- forward_messages missing HOT 2
- Pyrogram is incompatible with PYTHONOPTIMIZE=2 (or -OO)
- CHAT_ADMIN_REQUIRED HOT 5
- Unable to connect due to network issues: Connection timed out
- Hardcoded Session.START_TIMEOUT
- issue tiwh
- Trouble Accessing Messages Containing Quotes HOT 2
- Fetch more than 200 or filter by deleted / last seen a long time ago #4342 HOT 1
- Ability to specify session file path HOT 1
- Issue: Ban from 'pyrogramchat' Telegram Group Due to Verification Bot Malfunction HOT 1
- Slow Upload Speed HOT 1
- [400 PEER_ID_INVALID] but I met this peer in a group chat! On real client I can DM them. HOT 2
- 求大佬维护群聊管理员匿名用户的识别问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrogram.