Commit graph

132 commits

Author SHA1 Message Date
Dan
9bf742abc0 Introduce back some previously reverted changes 2022-12-27 13:40:42 +01:00
Dan
bff583ed75 Revert some of the latest changes 2022-12-26 22:26:55 +01:00
Dan
235dde2251 Update exception message 2022-12-26 20:11:58 +01:00
Dan
d298c62c6d Update session.py 2022-12-26 16:34:49 +01:00
Dan
ce8c242eb4 Revert to triggering a reconnection when skipping invalid packets 2022-12-25 15:14:12 +01:00
Dan
b23e34494e Add messages for mismatched checks 2022-12-25 15:08:02 +01:00
Dan
ae028ab4b6 Switch back to local system time synchronization
perf_counter will stop counting when the system goes to sleep, causing
the generation of invalid message ids after waking up which in turn put
the client into a never ending reconnecting loop due to check mismatches
caused by the time not being synced anymore. It's also unclear whether
perf_counter stays in sync during long runs.
2022-12-25 14:55:40 +01:00
Dan
84d60b56b3 Switch to non-blocking sockets & use a send queue 2022-12-24 16:15:07 +01:00
Dan
b59dcd1615 Do not trigger a reconnection when skipping invalid packets 2022-06-20 09:32:10 +02:00
Dan
7c3c0565b4 Fix wrapped function invocations 2022-05-14 17:29:11 +02:00
Dan
4e1b54288b Fix Client.name usage 2022-04-24 11:56:07 +02:00
Dan
124bcb4db7 Remove API key requirement for existing sessions 2022-04-24 11:56:07 +02:00
Dan
0e3c2e4412 Rename RPCError.x to RPCError.value 2022-04-24 11:56:07 +02:00
Dan
78efb04b40 Rename Client.send to Client.invoke 2022-04-24 11:56:07 +02:00
Dan
dc6c816c80 Revert some of the last changes 2022-02-10 06:44:42 +01:00
Dan
5889c67fb5 Initialize session on reconnection 2022-02-10 05:34:21 +01:00
Dan
462e5d11a5 Improve stability in case of connection failures 2022-02-10 01:05:36 +01:00
Dan
3a911956b0 Update message for automatic sleeps 2022-01-31 20:45:04 +01:00
Dan
6f9e77bc2c Do not handle messages with a pending ack 2022-01-31 20:42:44 +01:00
Dan
1162e89f26 Better handling of expiring server salts 2022-01-20 09:43:29 +01:00
Dan
626a1bd938 Update copyright year 2022-01-07 10:23:45 +01:00
Dan
8c8288412f Various improvements 2022-01-07 10:18:51 +01:00
Dan
a3fab6af4b Merge branch 'mtproto-checks'
# Conflicts:
#	pyrogram/errors/__init__.py
#	pyrogram/session/session.py
2021-12-24 16:28:29 +01:00
Dan
56e7e11037 Use a specialized exception for handling BadMsgNotification 2021-12-22 14:01:05 +01:00
Dan
8aa358129c Use specialized exceptions for handling security checks 2021-12-16 21:38:24 +01:00
Dan
ed9c7e4694 Simplify the error handling a bit 2021-12-15 19:26:54 +01:00
Dan
2a1af2b8e9 Close and reestablish the TCP connection in case of mismatch 2021-12-15 16:02:39 +01:00
Dan
cd027b8c1c Implement missing MTProto checks 2021-12-15 13:18:13 +01:00
Dan
54350dc943 Merge branch 'handle-503-timeout' 2021-04-26 15:32:07 +02:00
Dan
3c81006b40 Merge branch 'media-servers' 2021-04-26 15:31:08 +02:00
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