Commit graph

152 commits

Author SHA1 Message Date
Dan
c5624c639b Cleaner error message 2021-04-15 12:17:25 +02:00
Dan
0c814e9e5e Add support for media DC IPs 2021-04-13 15:53:53 +02:00
Dan
70ae12eb77 Handle ServiceUnavailable errors
#664
2021-04-12 09:21:20 +02:00
Dan
a48d27f501 Always run crypto-related functions in the dedicated thread 2021-01-02 18:45:43 +01:00
Dan
7dda167c09 Update copyright notice
Year 2021
2021-01-01 22:58:48 +01:00
Dan
a8a9a1ac1f Also print the exception type when logging query issues
Use "repr(e)" instead of "e" alone (i.e "str(e)") because sometimes
builtin exceptions have no message (for example: OSError, TimeoutError)
2020-12-27 21:08:01 +01:00
Dan
8b3e1ce9cc Make generating new salts independent of the system clock
Closes #553
2020-12-12 16:46:40 +01:00
Dan
844e53a70e Move crypto calls to threads in case of big enough chunks 2020-12-07 19:16:46 +01:00
Dan
76985faa11 Evaluate debug raw data only when actually needed
#541
2020-11-20 01:53:19 +01:00
Dan
582e29dece Allow passing sleep_threshold=0 to always raise flood waits 2020-08-27 10:59:28 +02:00
Dan
7c987889f0 Add sleep_threshold parameter to send() method
- Decrease the default sleep threshold from 60 to 10 seconds
- Use a higher sleep threshold for generator methods
2020-08-26 09:01:01 +02:00
Dan
fbded4e23b Fix time going out of sync when starting new sessions 2020-08-22 11:26:11 +02:00
Dan
538f1e3972 Deep rewrite: preparing for v1.0
- Pyrogram core is now fully asynchronous
- Ditched Python 3.5, welcome 3.6 as minimum version.
- Moved all types to pyrogram.types
- Turned the Filters class into a module (filters)
- Moved all filters to pyrogram.filters
- Moved all handlers to pyrogram.handlers
- Moved all emoji to pyrogram.emoji
- Renamed pyrogram.api to pyrogram.raw
- Clock is now synced with server's time
- Telegram schema updated to Layer 117
- Greatly improved the TL compiler (proper type-constructor hierarchy)
- Added "do not edit" warning in generated files
- Crypto parts are executed in a thread pool to avoid blocking the event loop
- idle() is now a separate function (it doesn't deal with Client instances)
- Async storage, async filters and async progress callback (optional, can be sync too)
- Added getpass back, for hidden password inputs
2020-08-22 08:05:05 +02:00
CyanBook
c8c6faa96e
Change logging hierarchy for loading plugins (#451)
Loading plugins shouldn't be considered a warning
2020-08-21 07:28:27 +02:00
Dan
7df85e2039 Show more relevant information when DEBUG logs are enabled
Show exactly what is being sent and received
2020-06-02 13:05:26 +02:00
Dan
128ab4b0b9 Move the automatic sleep mechanism down to Session 2020-05-07 13:38:22 +02:00
Dan
1996fb1481 Update Copyright 2020-03-21 15:43:32 +01:00
Dan
2bf6357bad Show more meaningful errors for wrapped queries 2020-02-01 15:19:05 +01:00
Dan
42c9bafa0c Update copyright notice 2020-02-01 14:04:33 +01:00
Dan
1a7d0b1b7e Update Storage API usages in client.py, auth.py and session.py 2019-09-14 19:57:20 +02:00
Dan
a015f998fa Revert "Stop instantiating logger objects and directly use the logging module"
This reverts commit 792068d7
2019-09-08 19:24:06 +02:00
Dan
792068d7c8 Stop instantiating logger objects and directly use the logging module 2019-09-08 12:59:28 +02:00
Dan
4b914662ef Log the reason why a query ought to be re-tried 2019-08-13 13:20:21 +02:00
Dan
aa135ea457 Reformat project 2019-08-01 19:11:43 +02:00
Dan
72b7a53ff5 Log to warning only in the last attempt 2019-07-25 11:15:56 +02:00
Dan
682591ea8f Update Auth and Session to accommodate Storage Engines 2019-06-19 16:02:29 +02:00
Dan
142d5ab335 Merge branch 'develop' into session_storage
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
#	pyrogram/client/ext/syncer.py
#	pyrogram/client/methods/contacts/get_contacts.py
2019-06-15 23:52:34 +02:00
Dan
d5517f4d5f Rename Object to TLObject 2019-06-03 14:19:50 +02:00
Dan
48a5da8958 Let FutureSalt(s) attributes be plain integer instead of datetime values 2019-05-31 16:36:20 +02:00
bakatrouble
952f0627f1 Merge branch 'develop' into session_storage
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
#	pyrogram/client/ext/syncer.py
#	pyrogram/client/style/html.py
#	pyrogram/client/style/markdown.py
2019-04-14 21:49:45 +03:00
Dan
b5c6db6db0 Refactor project and move errors namespace out from pyrogram.api 2019-03-25 11:23:45 +01:00
Dan
34b51b6481 Force keyword arguments for all TL types 2019-03-16 16:53:52 +01:00
Dan
e42599051c Use a lower timeout when starting a session to speed up re-connections
Sometimes the server drops right after a successful connection and
pyrogram keeps waiting up 15 seconds (current WAIT_TIMEOUT) for the
first query to time out and start again a new connection.
2019-03-03 16:50:25 +01:00
bakatrouble
5dc33c6337 add in-memory session storage, refactor session storages, remove mixin 2019-02-22 03:37:19 +03:00
Dan
4d7b1bafac Update copyright year 2019-01-01 12:36:16 +01:00
Dan
e7a85520f2 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	pyrogram/client/client.py
2018-09-17 15:59:49 +02:00
Dan
b619818c40
Clear recv_queue on session stop. Fixes #103 2018-09-03 16:35:22 +02:00
Dan
b845544e63 Info log device and system parameters 2018-08-28 12:39:14 +02:00
Dan
f50638772c Minor fix: update info log 2018-08-28 12:38:02 +02:00
Dan
4b3b647245 Merge branch 'ipv6' into develop
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/session/session.py
2018-08-28 12:19:37 +02:00
Dan
6e4c608875 Handle AUTH_KEY_DUPLICATED error 2018-06-28 00:16:12 +02:00
Dan
ecaba45523 Keep only lang_code 2018-06-27 00:42:32 +02:00
Dan
c7d60ef8a6 Fix disconnect handler callback being called on every session 2018-06-24 19:29:12 +02:00
Dan
55ef4abb27 Allow user-defined session properties. Related to #86
This commit adds five 5 extra parameters to the Client class:
app_version, device_model, system_version, system_lang_code, lang_code
2018-06-24 18:47:49 +02:00
Dan
f4c0793a0b Make session leaner by removing some redundant parameters
Related to #86
2018-06-24 18:27:41 +02:00
Dan
69d1432251 Allow user-defined values for retries and timeout 2018-06-24 17:47:29 +02:00
Dan
b804709c6c Allow session to use ipv6 2018-06-13 13:37:35 +02:00
Dan
65c209000c Connection refactoring 2018-05-24 21:19:57 +02:00
Dan
9001ccd11f Add DisconnectHandler 2018-05-23 14:27:17 +02:00
Dan
f0c801be8c Rename AES class methods and add ctr256_encrypt 2018-05-18 14:15:35 +02:00
Dan
e270c7d5f8 Remove unpack_dispatch_and_ack method 2018-05-06 14:55:41 +02:00
Dan
de332471df Join net worker threads before stopping. Fixes #62 2018-04-29 20:30:32 +02:00
Dan
b59212dbf2 Fix send() not returning the value in case of a retry 2018-04-18 17:19:42 +02:00
Dan
639828f550 Retry on internal server errors, up to MAX_RETRIES times
Also add support for custom retry count
2018-04-18 15:17:46 +02:00
Dan
6dcdeda244 Make proxy loading simpler 2018-04-13 12:30:13 +02:00
Dan
9dc767b88e Wait a little bit before retrying 2018-04-12 10:41:52 +02:00
Dan
552474a0e2 Raise any other unknown exception 2018-04-12 08:30:52 +02:00
Dan
862567a1ed Tune session settings 2018-04-12 08:29:39 +02:00
Dan
cce937e54b Set correct type hint 2018-04-05 11:43:56 +02:00
Dan
6fd8b582b2 More useful logging 2018-03-16 11:30:05 +01:00
Dan
4dbf1ef5ac Improve re-connection speed 2018-03-16 11:18:16 +01:00
Dan
756311710c Don't GetTermsOfService() anymore 2018-03-15 12:03:02 +01:00
Dan
475012144d
Increase WAIT_TIMEOUT to 30s 2018-03-13 00:21:48 +01:00
Dan
26adfc2ef4 Add BadMsgNotification error descriptions. Fixes #26 2018-02-22 01:31:39 +01:00
Dan
140a8b4e12 Catch RPCError in InitConnection 2018-02-21 13:35:17 +01:00
Dan
02da3fe947 Handle TCP server errors 2018-02-18 20:33:33 +01:00
Dan
d89d238d30 Fix BadMsgNotification error_code 32 2018-02-18 17:31:00 +01:00
Dan
1bf74a9c25 Merge branch 'master' into tgcrypto 2018-02-16 18:42:43 +01:00
Dan
ad6cfcd165 Use PingDelayDisconnect instead 2018-02-15 21:06:25 +01:00
Dan
e14a3644ba Merge branch 'master' into tgcrypto 2018-02-14 17:34:21 +01:00
Dan
df89669e04 Revert back to "set_update_handler" name 2018-02-13 12:08:10 +01:00
Dan
85b573d1e5 Set NET_WORKERS to 1 2018-02-10 18:28:11 +01:00
Dan
f158b780aa Merge branch 'master' into tgcrypto 2018-02-09 03:27:13 +01:00
Dan
bd75dc8082 Set NET_WORKERS to 2 2018-02-08 20:47:56 +01:00
Dan
d8edfb38bf Move update handler into Client 2018-02-08 20:46:47 +01:00
Dan
7cee6b079f Revert to fixed NET_WORKERS count 2018-02-08 19:48:01 +01:00
Dan
5885f38245 Remove TODO 2018-02-08 19:03:44 +01:00
Dan
f36bb2678c Remove unused 2018-02-08 19:03:04 +01:00
Dan
f8688cd260 Rename worker to net_worker 2018-02-08 18:56:40 +01:00
Dan
00631fcc33 Use a better variable name 2018-02-08 17:34:00 +01:00
Dan
3097cadd8a Clean 2018-02-08 17:23:37 +01:00
Dan
807a50b82c Pass the client to the update handler as parameter 2018-02-01 02:41:19 +01:00
Dan
2b7425019b Merge IGE and CTR into a single class (AES) 2018-01-28 01:44:38 +01:00
Dan
7234edad5d Add ability to choose the amount of worker threads for the main session 2018-01-26 11:41:09 +01:00
Dan
ba21430512 Add SOCKS5 proxy support 2018-01-16 22:05:19 +01:00
Dan
d70c2bb564 Update copyright year 2018-01-01 13:24:07 +01:00
Dan
df5cee5b03 Remove unnecessary branch 2017-12-28 13:10:01 +01:00
Dan
211381a9a8 Skip already processed messages 2017-12-28 13:06:26 +01:00
Dan
f62ce30dbf Check if not None before calling .join() 2017-12-26 01:19:38 +01:00
Dan
5128f6310b Wait for threads to stop when closing the session 2017-12-23 23:43:20 +01:00
Dan
14632c9bb1 Don't call InitConnection on CDN DCs 2017-12-19 11:38:15 +01:00
Dan
5e157c2598 Remove old MTProto v1.0 code 2017-12-18 15:16:21 +01:00
Dan
316c426429 Handle non-existent auth_key_id errors 2017-12-18 09:50:41 +01:00
Dan
3051adb5b9 Set info level when logging acks 2017-12-12 08:38:05 +01:00
Dan
ff3dd4a3ba Increase wait timeout 2017-12-11 12:55:31 +01:00
Dan
33263e9ce6 Warn if retrying 2017-12-11 10:34:14 +01:00
Dan
519e9c8613 Display notice only once 2017-12-09 17:09:39 +01:00
Dan
87b2c4b1e7 Comment out MTProto 1.0 implementation 2017-12-09 02:25:14 +01:00
Dan
a3e5ba8862 Use MTProto 2.0 instead of 1.0 2017-12-09 02:24:21 +01:00
Dan
42f9a2d699 Add MTProto 2.0 implementation 2017-12-09 02:21:23 +01:00