spluspy 2.1.4__tar.gz → 2.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spluspy-2.1.4 → spluspy-2.1.6}/PKG-INFO +1 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/pyproject.toml +1 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/__version__.py +1 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/account.py +0 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/auth.py +2 -8
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/chats.py +1 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/dialogs.py +0 -2
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/downloads.py +0 -9
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/messages.py +0 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/telegrambaseclient.py +4 -10
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/updates.py +37 -71
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/uploads.py +0 -4
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/users.py +9 -15
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/__init__.py +84 -86
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/aes.py +2 -4
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/libssl.py +137 -138
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/extensions/binaryreader.py +231 -236
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/extensions/html.py +206 -208
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/extensions/messagepacker.py +119 -122
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/connection.py +2 -2
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/websocket.py +8 -12
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/mtprotosender.py +2 -50
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/mtprotostate.py +0 -4
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/sessions/sqlite.py +393 -394
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/chatgetter.py +2 -3
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/draft.py +194 -194
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/message.py +0 -4
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/messagebutton.py +0 -2
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/sendergetter.py +1 -2
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/version.py +1 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/afk.py +201 -202
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/client/chat_mixin.py +954 -973
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/client/client.py +423 -25
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/client/conversation.py +295 -294
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/client/media_mixin.py +522 -531
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/config.py +2 -2
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/message.py +15 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/filters/__init__.py +7 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/filters/filters.py +72 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/middleware/base.py +2 -2
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/mirror.py +204 -207
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/message.py +5 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/client.py +2 -12
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/connection.py +0 -6
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/http_client.py +347 -355
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/spluspy_adapter.py +450 -465
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/transport.py +249 -252
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/plugins/loader.py +0 -3
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/postgres.py +183 -183
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/redis.py +140 -140
- spluspy-2.1.6/spluspy/utils/logger.py +119 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/rate_limiter.py +2 -1
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/resolver.py +366 -372
- spluspy-2.1.4/spluspy/utils/logger.py +0 -282
- {spluspy-2.1.4 → spluspy-2.1.6}/.gitignore +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/CHANGELOG.md +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/CONTRIBUTING.md +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/Dockerfile +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/LICENSE +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/MANIFEST.in +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/README.md +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/README.rst +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/01_hello_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/02_echo_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/03_command_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/04_private_only.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/05_group_only.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/06_regex_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/07_user_filter.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/08_combined_filters.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/09_inline_keyboard.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/10_reply_keyboard.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/11_message_actions.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/12_media_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/13_fsm_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/14_plugin_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/15_middleware_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/16_scheduler_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/17_conversation.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/18_chat_management.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/19_event_types.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/20_sync_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/21_album_handler.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/22_download_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/23_url_button.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/24_string_session.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/25_error_handling.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/25_working_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/26_message_entities.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/27_search_messages.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/28_poll_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/29_dice_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/30_cache_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/31_reaction_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/32_mark_read_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/33_context_manager.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/34_user_info.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/35_chat_info.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/36_forward_copy.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/37_admin_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/38_media_filters.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/39_status_bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/40_delete_detection.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/41_read_detection.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/42_raw_events.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/43_poll_handler.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/44_reaction_handler.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/45_typing_handler.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/46_get_messages.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/47_iter_messages.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/48_get_members.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/49_resolve_username.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/examples/50_invoke.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/setup.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/_updates/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/_updates/entitycache.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/_updates/messagebox.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/_updates/session.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/bots.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/buttons.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/messageparse.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/client/soroushclient.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/aesctr.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/authkey.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/cdndecrypter.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/factorization.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/fast_aes.pyx +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/fast_rsa.pyx +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/crypto/rsa.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/custom.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/errors/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/errors/common.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/errors/rpcbaseerrors.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/errors/rpcerrorlist.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/album.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/callbackquery.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/chataction.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/common.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/inlinequery.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/messagedeleted.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/messageedited.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/messageread.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/newmessage.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/raw.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/events/userupdate.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/extensions/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/extensions/markdown.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/functions.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/helpers.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/hints.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/authenticator.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/http.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/tcpabridged.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/tcpfull.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/tcpintermediate.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/tcpmtproxy.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/connection/tcpobfuscated.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/mtprotoplainsender.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/network/requeststate.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/password.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/requestiter.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/sessions/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/sessions/abstract.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/sessions/memory.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/sessions/string.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/sync.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/alltlobjects.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/core/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/core/gzippacked.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/core/messagecontainer.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/core/rpcresult.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/core/tlmessage.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/adminlogevent.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/button.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/conversation.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/dialog.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/file.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/forward.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/inlinebuilder.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/inlineresult.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/inlineresults.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/inputsizedfile.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/participantpermissions.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/qrlogin.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/custom/types.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/account.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/auth.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/bots.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/channels.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/chatlists.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/conference.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/contacts.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/folders.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/help.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/langpack.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/messages.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/payments.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/phone.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/photos.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/premium.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/stats.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/stories.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/thirdParty.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/updates.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/upload.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/functions/users.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/patched/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/tlobject.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/account.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/auth.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/bots.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/channels.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/chatlists.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/conference.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/contacts.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/help.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/messages.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/payments.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/phone.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/photos.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/premium.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/stats.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/stickers.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/storage.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/stories.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/thirdParty.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/update.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/updates.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/upload.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/tl/types/users.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/types.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/_engine/utils.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/admin.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/cli.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/client/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/compat.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/errors/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/errors/exceptions.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/album.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/base.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/callback.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/chat_action.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/edited.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/inline.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/message_deleted.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/message_read.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/events/user_update.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/fsm/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/fsm/state.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/middleware/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/middleware/rate_limit.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/bot.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/chat.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/enums.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/media.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/objects.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/models/user.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/mtproto.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/network/protocols.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/plugins/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/py.typed +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/scheduler/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/scheduler/scheduler.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/session/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/session/base.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/session/memory.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/session/sqlite.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/session/string.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/base.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/entity_cache.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/memory.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/storage/sqlite.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/sync/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/sync/client.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/batch.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/cache.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/chat_lock.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/file_transfer.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/helpers.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/spluspy/utils/version_check.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/__init__.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_client.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_filters.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_fsm.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_fsm_enhanced.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_middleware.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_rate_limiter.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_resolver.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_scheduler.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_session.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_storage.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_types.py +0 -0
- {spluspy-2.1.4 → spluspy-2.1.6}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spluspy
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.6
|
|
4
4
|
Summary: A modern async Python library for interacting with Soroush Plus
|
|
5
5
|
Project-URL: Homepage, https://github.com/Itskillmaster/spluspy
|
|
6
6
|
Project-URL: Documentation, https://github.com/Itskillmaster/spluspy#readme
|
|
@@ -160,7 +160,7 @@ class AuthMethods:
|
|
|
160
160
|
'you are accidentally reusing an existing session'
|
|
161
161
|
)
|
|
162
162
|
except Exception as e:
|
|
163
|
-
|
|
163
|
+
pass
|
|
164
164
|
|
|
165
165
|
return self
|
|
166
166
|
|
|
@@ -352,7 +352,6 @@ class AuthMethods:
|
|
|
352
352
|
except Exception as e:
|
|
353
353
|
# get_me may fail on Soroush (GetUsersRequest returns 500).
|
|
354
354
|
# Check authorization via GetState instead.
|
|
355
|
-
_log.debug('get_me failed, checking auth state: %s', e)
|
|
356
355
|
if await self.is_user_authorized():
|
|
357
356
|
return None
|
|
358
357
|
if me:
|
|
@@ -400,7 +399,6 @@ class AuthMethods:
|
|
|
400
399
|
try:
|
|
401
400
|
me = await self.get_me()
|
|
402
401
|
except Exception as e:
|
|
403
|
-
_log.debug('get_me failed after auth check: %s', e)
|
|
404
402
|
me = None
|
|
405
403
|
if me:
|
|
406
404
|
return await self._on_login(me)
|
|
@@ -421,7 +419,7 @@ class AuthMethods:
|
|
|
421
419
|
int(state.date.timestamp()), state.seq, 0),
|
|
422
420
|
[])
|
|
423
421
|
except Exception as e:
|
|
424
|
-
|
|
422
|
+
pass
|
|
425
423
|
return None
|
|
426
424
|
raise
|
|
427
425
|
|
|
@@ -537,9 +535,6 @@ class AuthMethods:
|
|
|
537
535
|
if _retry_count > 2:
|
|
538
536
|
raise
|
|
539
537
|
self._phone_code_hash.pop(phone, None)
|
|
540
|
-
self._log[__name__].debug(
|
|
541
|
-
"Phone code expired in ResendCodeRequest, requesting a new code"
|
|
542
|
-
)
|
|
543
538
|
return await self.send_code_request(
|
|
544
539
|
phone, force_sms=False, _retry_count=_retry_count+1)
|
|
545
540
|
|
|
@@ -608,7 +603,6 @@ class AuthMethods:
|
|
|
608
603
|
try:
|
|
609
604
|
await self(functions.auth.LogOutRequest())
|
|
610
605
|
except errors.RPCError as e:
|
|
611
|
-
_log.debug('Logout failed: %s', e)
|
|
612
606
|
return False
|
|
613
607
|
|
|
614
608
|
self._mb_entity_cache.set_self_user(None, None, None)
|
|
@@ -88,7 +88,7 @@ class _ChatAction:
|
|
|
88
88
|
await self._client(self._request)
|
|
89
89
|
await asyncio.sleep(self._delay)
|
|
90
90
|
except ConnectionError as e:
|
|
91
|
-
|
|
91
|
+
pass
|
|
92
92
|
except asyncio.CancelledError:
|
|
93
93
|
if self._auto_cancel:
|
|
94
94
|
await self._client(functions.messages.SetTypingRequest(
|
|
@@ -467,7 +467,6 @@ class DialogMethods:
|
|
|
467
467
|
))
|
|
468
468
|
except errors.PeerIdInvalidError as e:
|
|
469
469
|
# Happens if we didn't have the deactivated information
|
|
470
|
-
_log.debug('PeerIdInvalidError when deleting chat: %s', e)
|
|
471
470
|
result = None
|
|
472
471
|
else:
|
|
473
472
|
result = None
|
|
@@ -564,7 +563,6 @@ class DialogMethods:
|
|
|
564
563
|
await self.delete_dialog(entity, revoke=revoke)
|
|
565
564
|
result["success"] += 1
|
|
566
565
|
result["details"].append({"id": user_id, "title": title, "status": "deleted"})
|
|
567
|
-
_log.debug("delete_all_private: deleted %s (%d)", title, user_id)
|
|
568
566
|
except Exception as exc:
|
|
569
567
|
result["failed"] += 1
|
|
570
568
|
result["details"].append({"id": user_id, "title": title, "status": "failed"})
|
|
@@ -108,12 +108,10 @@ class _DirectDownloadIter(RequestIter):
|
|
|
108
108
|
raise
|
|
109
109
|
|
|
110
110
|
self._timed_out = True
|
|
111
|
-
self.client._log[__name__].debug('Got timeout while downloading file, retrying once')
|
|
112
111
|
await asyncio.sleep(TIMED_OUT_SLEEP)
|
|
113
112
|
return await self._request()
|
|
114
113
|
|
|
115
114
|
except errors.FileMigrateError as e:
|
|
116
|
-
self.client._log[__name__].debug('File lives in another DC')
|
|
117
115
|
self._sender = await self.client._borrow_exported_sender(e.new_dc)
|
|
118
116
|
self._exported = True
|
|
119
117
|
return await self._request()
|
|
@@ -125,7 +123,6 @@ class _DirectDownloadIter(RequestIter):
|
|
|
125
123
|
or self.request.location.thumb_size != '':
|
|
126
124
|
raise
|
|
127
125
|
|
|
128
|
-
self.client._log[__name__].debug('File ref expired during download; refetching message')
|
|
129
126
|
chat, msg_id = self._msg_data
|
|
130
127
|
msg = await self.client.get_messages(chat, ids=msg_id)
|
|
131
128
|
|
|
@@ -586,7 +583,6 @@ class DownloadMethods:
|
|
|
586
583
|
if in_memory:
|
|
587
584
|
return f.getvalue()
|
|
588
585
|
except _CdnRedirect as e:
|
|
589
|
-
self._log[__name__].debug('FileCdnRedirect to CDN data center %s', e.cdn_redirect.dc_id)
|
|
590
586
|
return await self._download_file(
|
|
591
587
|
input_location=input_location,
|
|
592
588
|
file=file,
|
|
@@ -754,12 +750,8 @@ class DownloadMethods:
|
|
|
754
750
|
and stride % MIN_CHUNK_SIZE == 0 \
|
|
755
751
|
and (limit is None or offset % limit == 0):
|
|
756
752
|
cls = _DirectDownloadIter
|
|
757
|
-
self._log[__name__].debug('Starting direct file download in chunks of '
|
|
758
|
-
'%d at %d, stride %d', request_size, offset, stride)
|
|
759
753
|
else:
|
|
760
754
|
cls = _GenericDownloadIter
|
|
761
|
-
self._log[__name__].debug('Starting indirect file download in chunks of '
|
|
762
|
-
'%d at %d, stride %d', request_size, offset, stride)
|
|
763
755
|
|
|
764
756
|
return cls(
|
|
765
757
|
self,
|
|
@@ -1064,7 +1056,6 @@ class DownloadMethods:
|
|
|
1064
1056
|
if x and not isreserved(x)
|
|
1065
1057
|
)
|
|
1066
1058
|
except StopIteration:
|
|
1067
|
-
_log.debug('No valid filename found in possible_names')
|
|
1068
1059
|
name = None
|
|
1069
1060
|
|
|
1070
1061
|
if not name:
|
|
@@ -311,7 +311,6 @@ class _IDsIter(RequestIter):
|
|
|
311
311
|
functions.channels.GetMessagesRequest(self._entity, ids))
|
|
312
312
|
except errors.MessageIdsEmptyError as e:
|
|
313
313
|
# All IDs were invalid, use a dummy result
|
|
314
|
-
_log.debug('MessageIdsEmptyError for channel messages: %s', e)
|
|
315
314
|
r = types.messages.MessagesNotModified(len(ids))
|
|
316
315
|
else:
|
|
317
316
|
r = await self.client(functions.messages.GetMessagesRequest(ids))
|
|
@@ -394,6 +394,7 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
394
394
|
# Used for non-sequential updates, in order to terminate all pending tasks on disconnect.
|
|
395
395
|
self._sequential_updates = sequential_updates
|
|
396
396
|
self._event_handler_tasks = set()
|
|
397
|
+
self._max_handler_tasks = 50 # Limit concurrent handler tasks
|
|
397
398
|
|
|
398
399
|
self._authorized = None # None = unknown, False = no, True = yes
|
|
399
400
|
|
|
@@ -574,7 +575,7 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
574
575
|
self_user = await utils.maybe_async(self.session.get_input_entity(self_id))
|
|
575
576
|
self._mb_entity_cache.set_self_user(self_id, None, self_user.access_hash)
|
|
576
577
|
except ValueError as e:
|
|
577
|
-
|
|
578
|
+
pass
|
|
578
579
|
|
|
579
580
|
if self._catch_up:
|
|
580
581
|
ss = SessionState(0, 0, False, 0, 0, 0, 0, None)
|
|
@@ -610,7 +611,7 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
610
611
|
# Soroush server sends config types with custom constructor IDs
|
|
611
612
|
# and different field layouts than standard SoroushPlus. The response
|
|
612
613
|
# is not used anyway, so we can safely ignore parse errors.
|
|
613
|
-
|
|
614
|
+
pass
|
|
614
615
|
|
|
615
616
|
# Don't call get_me() here — on Soroush the auth key is not
|
|
616
617
|
# registered until after login, and GetUsersRequest (used by
|
|
@@ -671,7 +672,7 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
671
672
|
# "Event loop stopped before Future completed."
|
|
672
673
|
#
|
|
673
674
|
# However, it doesn't really make a lot of sense.
|
|
674
|
-
|
|
675
|
+
pass
|
|
675
676
|
|
|
676
677
|
def set_proxy(self: 'SoroushClient', proxy: typing.Union[tuple, dict]):
|
|
677
678
|
"""
|
|
@@ -774,7 +775,6 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
774
775
|
"""
|
|
775
776
|
Permanently switches the current connection to the new data center.
|
|
776
777
|
"""
|
|
777
|
-
self._log[__name__].debug('Reconnecting to new data center %s', new_dc)
|
|
778
778
|
dc = await self._get_dc(new_dc)
|
|
779
779
|
|
|
780
780
|
await utils.maybe_async(self.session.set_dc(dc.id, dc.ip_address, dc.port))
|
|
@@ -884,7 +884,6 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
884
884
|
proxy=self._proxy,
|
|
885
885
|
local_addr=self._local_addr
|
|
886
886
|
))
|
|
887
|
-
self._log[__name__].debug('Exporting auth for new borrowed sender in %s', dc)
|
|
888
887
|
auth = await self(functions.auth.ExportAuthorizationRequest(dc_id))
|
|
889
888
|
self._init_request.query = functions.auth.ImportAuthorizationRequest(id=auth.id, bytes=auth.bytes)
|
|
890
889
|
req = functions.InvokeWithLayerRequest(LAYER, self._init_request)
|
|
@@ -900,7 +899,6 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
900
899
|
Once its job is over it should be `_return_exported_sender`.
|
|
901
900
|
"""
|
|
902
901
|
async with self._borrow_sender_lock:
|
|
903
|
-
self._log[__name__].debug('Borrowing sender for dc_id %d', dc_id)
|
|
904
902
|
state, sender = self._borrowed_senders.get(dc_id, (None, None))
|
|
905
903
|
|
|
906
904
|
if state is None:
|
|
@@ -929,7 +927,6 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
929
927
|
been returned, the sender is cleanly disconnected.
|
|
930
928
|
"""
|
|
931
929
|
async with self._borrow_sender_lock:
|
|
932
|
-
self._log[__name__].debug('Returning borrowed sender for dc_id %d', sender.dc_id)
|
|
933
930
|
state, _ = self._borrowed_senders[sender.dc_id]
|
|
934
931
|
state.add_return()
|
|
935
932
|
|
|
@@ -940,8 +937,6 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
940
937
|
async with self._borrow_sender_lock:
|
|
941
938
|
for dc_id, (state, sender) in self._borrowed_senders.items():
|
|
942
939
|
if state.should_disconnect():
|
|
943
|
-
self._log[__name__].debug(
|
|
944
|
-
'Disconnecting borrowed sender for DC %d', dc_id)
|
|
945
940
|
|
|
946
941
|
# Disconnect should never raise
|
|
947
942
|
await sender.disconnect()
|
|
@@ -956,7 +951,6 @@ class SoroushPlusBaseClient(abc.ABC):
|
|
|
956
951
|
await utils.maybe_async(session.set_dc(dc.id, dc.ip_address, dc.port))
|
|
957
952
|
self._exported_sessions[cdn_redirect.dc_id] = session
|
|
958
953
|
|
|
959
|
-
self._log[__name__].debug('Creating new CDN client')
|
|
960
954
|
client = self.__class__(
|
|
961
955
|
session, self.api_id, self.api_hash,
|
|
962
956
|
proxy=self._proxy,
|
|
@@ -4,7 +4,6 @@ import itertools
|
|
|
4
4
|
import random
|
|
5
5
|
import sys
|
|
6
6
|
import time
|
|
7
|
-
import traceback
|
|
8
7
|
import typing
|
|
9
8
|
import logging
|
|
10
9
|
import warnings
|
|
@@ -284,14 +283,11 @@ class UpdateMethods:
|
|
|
284
283
|
if self._sequential_updates:
|
|
285
284
|
await self._dispatch_update(updates_to_dispatch.popleft())
|
|
286
285
|
else:
|
|
287
|
-
#
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
task = self.loop.create_task(self._dispatch_update(updates_to_dispatch.popleft()))
|
|
293
|
-
self._event_handler_tasks.add(task)
|
|
294
|
-
task.add_done_callback(self._event_handler_tasks.discard)
|
|
286
|
+
# Respect concurrency limit to prevent memory issues with many groups
|
|
287
|
+
if len(self._event_handler_tasks) < self._max_handler_tasks:
|
|
288
|
+
task = self.loop.create_task(self._dispatch_update(updates_to_dispatch.popleft()))
|
|
289
|
+
self._event_handler_tasks.add(task)
|
|
290
|
+
task.add_done_callback(self._event_handler_tasks.discard)
|
|
295
291
|
|
|
296
292
|
continue
|
|
297
293
|
|
|
@@ -299,7 +295,6 @@ class UpdateMethods:
|
|
|
299
295
|
|
|
300
296
|
get_diff = self._message_box.get_difference()
|
|
301
297
|
if get_diff:
|
|
302
|
-
self._log[__name__].debug('Getting difference for account updates')
|
|
303
298
|
try:
|
|
304
299
|
diff = await self(get_diff)
|
|
305
300
|
except (
|
|
@@ -309,12 +304,10 @@ class UpdateMethods:
|
|
|
309
304
|
ValueError
|
|
310
305
|
) as e:
|
|
311
306
|
# SoroushPlus is having issues
|
|
312
|
-
self._log[__name__].debug('Cannot get difference since SoroushPlus is having issues: %s', type(e).__name__)
|
|
313
307
|
self._message_box.end_difference()
|
|
314
308
|
continue
|
|
315
309
|
except (errors.UnauthorizedError, errors.AuthKeyError) as e:
|
|
316
310
|
# Not logged in or broken authorization key, can't get difference
|
|
317
|
-
self._log[__name__].debug('Cannot get difference since the account is not logged in: %s', type(e).__name__)
|
|
318
311
|
self._message_box.end_difference()
|
|
319
312
|
if was_once_logged_in:
|
|
320
313
|
self._updates_error = e
|
|
@@ -341,21 +334,16 @@ class UpdateMethods:
|
|
|
341
334
|
# Network is likely down, but it's unclear for how long.
|
|
342
335
|
# If disconnect is called this task will be cancelled along with the sleep.
|
|
343
336
|
# If disconnect is not called, getting difference should be retried after a few seconds.
|
|
344
|
-
self._log[__name__].debug('Cannot get difference since the network is down: %s: %s', type(e).__name__, e)
|
|
345
337
|
self._message_box.end_difference()
|
|
346
338
|
await asyncio.sleep(5)
|
|
347
339
|
continue
|
|
348
340
|
updates, users, chats = self._message_box.apply_difference(diff, self._mb_entity_cache)
|
|
349
|
-
if updates:
|
|
350
|
-
self._log[__name__].debug('Got difference for account updates')
|
|
351
|
-
|
|
352
341
|
_preprocess_updates = await self._preprocess_updates(updates, users, chats)
|
|
353
342
|
updates_to_dispatch.extend(_preprocess_updates)
|
|
354
343
|
continue
|
|
355
344
|
|
|
356
345
|
get_diff = self._message_box.get_channel_difference(self._mb_entity_cache)
|
|
357
346
|
if get_diff:
|
|
358
|
-
self._log[__name__].debug('Getting difference for channel %s updates', get_diff.channel.channel_id)
|
|
359
347
|
try:
|
|
360
348
|
diff = await self(get_diff)
|
|
361
349
|
except (errors.UnauthorizedError, errors.AuthKeyError) as e:
|
|
@@ -426,10 +414,6 @@ class UpdateMethods:
|
|
|
426
414
|
# Timeout triggered a get difference, but we have been banned in the channel since then.
|
|
427
415
|
# Because we can no longer fetch updates from this channel, we should stop keeping track
|
|
428
416
|
# of it entirely.
|
|
429
|
-
self._log[__name__].debug(
|
|
430
|
-
'Account is now banned in %d so we can no longer fetch updates from it',
|
|
431
|
-
get_diff.channel.channel_id
|
|
432
|
-
)
|
|
433
417
|
self._message_box.end_channel_difference(
|
|
434
418
|
get_diff,
|
|
435
419
|
PrematureEndReason.BANNED,
|
|
@@ -450,10 +434,6 @@ class UpdateMethods:
|
|
|
450
434
|
)
|
|
451
435
|
continue
|
|
452
436
|
except OSError as e:
|
|
453
|
-
self._log[__name__].debug(
|
|
454
|
-
'Cannot get difference for channel %d since the network is down: %s: %s',
|
|
455
|
-
get_diff.channel.channel_id, type(e).__name__, e
|
|
456
|
-
)
|
|
457
437
|
self._message_box.end_channel_difference(
|
|
458
438
|
get_diff,
|
|
459
439
|
PrematureEndReason.TEMPORARY_SERVER_ISSUES,
|
|
@@ -463,9 +443,6 @@ class UpdateMethods:
|
|
|
463
443
|
continue
|
|
464
444
|
|
|
465
445
|
updates, users, chats = self._message_box.apply_channel_difference(get_diff, diff, self._mb_entity_cache)
|
|
466
|
-
if updates:
|
|
467
|
-
self._log[__name__].debug('Got difference for channel %d updates', get_diff.channel.channel_id)
|
|
468
|
-
|
|
469
446
|
_preprocess_updates = await self._preprocess_updates(updates, users, chats)
|
|
470
447
|
updates_to_dispatch.extend(_preprocess_updates)
|
|
471
448
|
continue
|
|
@@ -498,7 +475,6 @@ class UpdateMethods:
|
|
|
498
475
|
try:
|
|
499
476
|
updates = await asyncio.wait_for(self._updates_queue.get(), deadline_delay)
|
|
500
477
|
except asyncio.TimeoutError:
|
|
501
|
-
self._log[__name__].debug('Timeout waiting for updates expired')
|
|
502
478
|
continue
|
|
503
479
|
else:
|
|
504
480
|
continue
|
|
@@ -649,6 +625,7 @@ class UpdateMethods:
|
|
|
649
625
|
if conv._custom:
|
|
650
626
|
await conv._check_custom(built)
|
|
651
627
|
|
|
628
|
+
tasks = []
|
|
652
629
|
for builder, callback in self._event_builders:
|
|
653
630
|
event = built[type(builder)]
|
|
654
631
|
if not event:
|
|
@@ -663,32 +640,27 @@ class UpdateMethods:
|
|
|
663
640
|
if not filter:
|
|
664
641
|
continue
|
|
665
642
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
if not isinstance(e, asyncio.CancelledError) or self.is_connected():
|
|
682
|
-
name = getattr(callback, '__name__', repr(callback))
|
|
683
|
-
self._log[__name__].exception('Unhandled exception on %s', name)
|
|
643
|
+
async def _run_cb(cb=callback, ev=event):
|
|
644
|
+
try:
|
|
645
|
+
await cb(ev)
|
|
646
|
+
except errors.AlreadyInConversationError:
|
|
647
|
+
pass
|
|
648
|
+
except events.StopPropagation:
|
|
649
|
+
pass
|
|
650
|
+
except Exception as e:
|
|
651
|
+
if not isinstance(e, asyncio.CancelledError) or self.is_connected():
|
|
652
|
+
self._log[__name__].exception('Unhandled exception on handler')
|
|
653
|
+
|
|
654
|
+
tasks.append(_run_cb())
|
|
655
|
+
|
|
656
|
+
if tasks:
|
|
657
|
+
await asyncio.gather(*tasks, return_exceptions=True)
|
|
684
658
|
|
|
685
659
|
async def _dispatch_event(self: 'SoroushClient', event):
|
|
686
660
|
"""
|
|
687
661
|
Dispatches a single, out-of-order event. Used by `AlbumHack`.
|
|
688
662
|
"""
|
|
689
|
-
|
|
690
|
-
# the name of speed; we don't want to make it worse for all updates
|
|
691
|
-
# just because albums may need it.
|
|
663
|
+
tasks = []
|
|
692
664
|
for builder, callback in self._event_builders:
|
|
693
665
|
if isinstance(builder, events.Raw):
|
|
694
666
|
continue
|
|
@@ -704,24 +676,21 @@ class UpdateMethods:
|
|
|
704
676
|
if not filter:
|
|
705
677
|
continue
|
|
706
678
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
if not isinstance(e, asyncio.CancelledError) or self.is_connected():
|
|
723
|
-
name = getattr(callback, '__name__', repr(callback))
|
|
724
|
-
self._log[__name__].exception('Unhandled exception on %s', name)
|
|
679
|
+
async def _run_cb(cb=callback, ev=event):
|
|
680
|
+
try:
|
|
681
|
+
await cb(ev)
|
|
682
|
+
except errors.AlreadyInConversationError:
|
|
683
|
+
pass
|
|
684
|
+
except events.StopPropagation:
|
|
685
|
+
pass
|
|
686
|
+
except Exception as e:
|
|
687
|
+
if not isinstance(e, asyncio.CancelledError) or self.is_connected():
|
|
688
|
+
self._log[__name__].exception('Unhandled exception on handler')
|
|
689
|
+
|
|
690
|
+
tasks.append(_run_cb())
|
|
691
|
+
|
|
692
|
+
if tasks:
|
|
693
|
+
await asyncio.gather(*tasks, return_exceptions=True)
|
|
725
694
|
|
|
726
695
|
async def _handle_auto_reconnect(self: 'SoroushClient'):
|
|
727
696
|
# Use lightweight get_me to let SoroushPlus know we want updates
|
|
@@ -732,15 +701,12 @@ class UpdateMethods:
|
|
|
732
701
|
'after reconnect: %s: %s', type(e), e)
|
|
733
702
|
|
|
734
703
|
try:
|
|
735
|
-
self._log[__name__].debug(
|
|
736
|
-
'Asking for the current state after reconnect...')
|
|
737
704
|
|
|
738
705
|
# If a disconnection occurs, the old known state will be
|
|
739
706
|
# the latest one we were aware of, so we can catch up since
|
|
740
707
|
# the most recent state we were aware of.
|
|
741
708
|
await self.catch_up()
|
|
742
709
|
|
|
743
|
-
self._log[__name__].debug('Successfully fetched missed updates')
|
|
744
710
|
except errors.RPCError as e:
|
|
745
711
|
self._log[__name__].warning('Failed to get missed updates after '
|
|
746
712
|
'reconnect: %r', e)
|
|
@@ -699,8 +699,6 @@ class UploadMethods:
|
|
|
699
699
|
hash_md5 = hashlib.md5()
|
|
700
700
|
|
|
701
701
|
part_count = (file_size + part_size - 1) // part_size
|
|
702
|
-
self._log[__name__].debug('Uploading file of %d bytes in %d chunks of %d',
|
|
703
|
-
file_size, part_count, part_size)
|
|
704
702
|
|
|
705
703
|
pos = 0
|
|
706
704
|
for part_index in range(part_count):
|
|
@@ -742,8 +740,6 @@ class UploadMethods:
|
|
|
742
740
|
|
|
743
741
|
result = await self(request)
|
|
744
742
|
if result:
|
|
745
|
-
self._log[__name__].debug('Uploaded %d/%d',
|
|
746
|
-
part_index + 1, part_count)
|
|
747
743
|
if progress_callback:
|
|
748
744
|
await helpers._maybe_await(progress_callback(pos, file_size))
|
|
749
745
|
else:
|
|
@@ -54,7 +54,6 @@ class UserMethods:
|
|
|
54
54
|
if diff <= 3: # Flood waits below 3 seconds are "ignored"
|
|
55
55
|
self._flood_waited_requests.pop(r.CONSTRUCTOR_ID, None)
|
|
56
56
|
elif diff <= flood_sleep_threshold:
|
|
57
|
-
self._log[__name__].debug(*_fmt_flood(diff, r, early=True))
|
|
58
57
|
await asyncio.sleep(diff)
|
|
59
58
|
self._flood_waited_requests.pop(r.CONSTRUCTOR_ID, None)
|
|
60
59
|
else:
|
|
@@ -125,14 +124,12 @@ class UserMethods:
|
|
|
125
124
|
e.seconds = 1
|
|
126
125
|
|
|
127
126
|
if e.seconds <= self.flood_sleep_threshold:
|
|
128
|
-
self._log[__name__].debug(*_fmt_flood(e.seconds, request))
|
|
129
127
|
await asyncio.sleep(e.seconds)
|
|
130
128
|
else:
|
|
131
129
|
raise
|
|
132
130
|
except (errors.PhoneMigrateError, errors.NetworkMigrateError,
|
|
133
131
|
errors.UserMigrateError) as e:
|
|
134
132
|
last_error = e
|
|
135
|
-
self._log[__name__].debug('Phone migrated to %d', e.new_dc)
|
|
136
133
|
should_raise = isinstance(e, (
|
|
137
134
|
errors.PhoneMigrateError, errors.NetworkMigrateError
|
|
138
135
|
))
|
|
@@ -181,7 +178,6 @@ class UserMethods:
|
|
|
181
178
|
|
|
182
179
|
return utils.get_input_peer(me, allow_self=False) if input_peer else me
|
|
183
180
|
except errors.UnauthorizedError as e:
|
|
184
|
-
_log.debug('Not authorized to get self user: %s', e)
|
|
185
181
|
return None
|
|
186
182
|
|
|
187
183
|
@property
|
|
@@ -229,7 +225,6 @@ class UserMethods:
|
|
|
229
225
|
await self(functions.updates.GetStateRequest())
|
|
230
226
|
self._authorized = True
|
|
231
227
|
except errors.RPCError as e:
|
|
232
|
-
_log.debug('Authorization check failed: %s', e)
|
|
233
228
|
self._authorized = False
|
|
234
229
|
except Exception:
|
|
235
230
|
raise
|
|
@@ -316,7 +311,7 @@ class UserMethods:
|
|
|
316
311
|
try:
|
|
317
312
|
lists[helpers._entity_type(x)].append(x)
|
|
318
313
|
except TypeError as e:
|
|
319
|
-
|
|
314
|
+
pass
|
|
320
315
|
|
|
321
316
|
users = lists[helpers._EntityType.USER]
|
|
322
317
|
chats = lists[helpers._EntityType.CHAT]
|
|
@@ -429,7 +424,7 @@ class UserMethods:
|
|
|
429
424
|
try:
|
|
430
425
|
return utils.get_input_peer(peer)
|
|
431
426
|
except TypeError as e:
|
|
432
|
-
|
|
427
|
+
pass
|
|
433
428
|
|
|
434
429
|
# Next in priority is having a peer (or its ID) cached in-memory
|
|
435
430
|
try:
|
|
@@ -437,7 +432,7 @@ class UserMethods:
|
|
|
437
432
|
if isinstance(peer, int) or peer.SUBCLASS_OF_ID == 0x2d45687:
|
|
438
433
|
return self._mb_entity_cache.get(utils.get_peer_id(peer, add_mark=False))._as_input_peer()
|
|
439
434
|
except AttributeError as e:
|
|
440
|
-
|
|
435
|
+
pass
|
|
441
436
|
|
|
442
437
|
# Then come known strings that take precedence
|
|
443
438
|
if peer in ('me', 'self'):
|
|
@@ -448,7 +443,7 @@ class UserMethods:
|
|
|
448
443
|
input_entity = await utils.maybe_async(self.session.get_input_entity(peer))
|
|
449
444
|
return input_entity
|
|
450
445
|
except ValueError as e:
|
|
451
|
-
|
|
446
|
+
pass
|
|
452
447
|
|
|
453
448
|
# Only network left to try
|
|
454
449
|
if isinstance(peer, str):
|
|
@@ -480,7 +475,7 @@ class UserMethods:
|
|
|
480
475
|
types.InputChannel(peer.channel_id, access_hash=0)]))
|
|
481
476
|
return utils.get_input_peer(channels.chats[0])
|
|
482
477
|
except errors.ChannelInvalidError as e:
|
|
483
|
-
|
|
478
|
+
pass
|
|
484
479
|
|
|
485
480
|
raise ValueError(
|
|
486
481
|
'Could not find the input entity for {} ({}). Please read https://'
|
|
@@ -519,7 +514,6 @@ class UserMethods:
|
|
|
519
514
|
# 0x2d45687, 0xc91c90b6 == crc32(b'Peer') and b'InputPeer'
|
|
520
515
|
peer = await self.get_input_entity(peer)
|
|
521
516
|
except AttributeError as e:
|
|
522
|
-
_log.debug('Peer has no SUBCLASS_OF_ID: %s', e)
|
|
523
517
|
peer = await self.get_input_entity(peer)
|
|
524
518
|
|
|
525
519
|
if isinstance(peer, types.InputPeerSelf):
|
|
@@ -583,13 +577,13 @@ class UserMethods:
|
|
|
583
577
|
else:
|
|
584
578
|
return next(x for x in result.chats if x.id == pid)
|
|
585
579
|
except StopIteration as e:
|
|
586
|
-
|
|
580
|
+
pass
|
|
587
581
|
try:
|
|
588
582
|
# Nobody with this username, maybe it's an exact name/title
|
|
589
583
|
input_entity = await utils.maybe_async(self.session.get_input_entity(string))
|
|
590
584
|
return await self.get_entity(input_entity)
|
|
591
585
|
except ValueError as e:
|
|
592
|
-
|
|
586
|
+
pass
|
|
593
587
|
|
|
594
588
|
raise ValueError(
|
|
595
589
|
'Cannot find any entity corresponding to "{}"'.format(string)
|
|
@@ -608,7 +602,7 @@ class UserMethods:
|
|
|
608
602
|
elif dialog.SUBCLASS_OF_ID == 0xc91c90b6: # crc32(b'InputPeer')
|
|
609
603
|
return types.InputDialogPeer(dialog)
|
|
610
604
|
except AttributeError as e:
|
|
611
|
-
|
|
605
|
+
pass
|
|
612
606
|
|
|
613
607
|
return types.InputDialogPeer(await self.get_input_entity(dialog))
|
|
614
608
|
|
|
@@ -624,7 +618,7 @@ class UserMethods:
|
|
|
624
618
|
notify.peer = await self.get_input_entity(notify.peer)
|
|
625
619
|
return notify
|
|
626
620
|
except AttributeError as e:
|
|
627
|
-
|
|
621
|
+
pass
|
|
628
622
|
|
|
629
623
|
return types.InputNotifyPeer(await self.get_input_entity(notify))
|
|
630
624
|
|