Commit Graph

2082 Commits

Author SHA1 Message Date
Lonami Exo
f6fe580eb7 Safer auto reconnect to prevent double connect 2019-03-22 19:01:40 +01:00
Lonami Exo
9eabca6987 Fix run_until_disconnected's call to disconnect 2019-03-22 18:20:10 +01:00
Lonami Exo
436fb64289 Prevent double autoreconnect like #1112 2019-03-22 16:21:18 +01:00
Lonami Exo
0662ead33b Properly document all optional dependencies 2019-03-21 16:55:32 +01:00
Lonami Exo
347db79979 run_until_disconnected() should disconnect() on finally 2019-03-21 12:25:19 +01:00
Lonami Exo
04ba2e1fc7 Revert disconnect() to be async again (#1133)
It's the only way to properly clean all background tasks,
which the library makes heavy use for in MTProto/Connection
send and receive loops.

Some parts of the code even relied on the fact that it was
asynchronous (it used to return a future so you could await
it and not be breaking).

It's automatically syncified to reduce the damage of being
a breaking change.
2019-03-21 12:21:00 +01:00
Lonami Exo
8f302bcdb0 Don't disconnect() on __del__ (#1133)
Destructors are not guaranteed to run. Despite having good
intentions (saving entities even if the user forgets), it
should be the user's responsability to cleanly close the
client under any circumstances.
2019-03-21 11:40:57 +01:00
Lonami Exo
2e4476a754 Workaround #1134 by early checking if proxy closes connection 2019-03-21 11:22:09 +01:00
Lonami Exo
f6c4ab6f41 Workaround #1124 (Telegram ignoring offset_date) 2019-03-18 17:36:06 +01:00
Lonami Exo
7c48857d0c Update docs for send_file/timeouts and add new known error 2019-03-18 17:34:48 +01:00
Lonami Exo
a5f5d6ef23 Minor doc updates, fixes and improvements
In particular, removed code which no longer worked, made light
theme easier on the eyes, added slight syntax highlightning,
and fixed search for exact matches.
2019-03-16 17:19:19 +01:00
Lonami
05e5becd78
Merge pull request #1126 from seriyps/mtproto-proxy-other-protocols
Implement different MTProto proxy protocols
2019-03-13 18:26:19 +01:00
Lonami Exo
598b9f25e1 Fix DialogsIter not passing the client to the built objects 2019-03-13 09:12:44 +01:00
Lonami Exo
9d5344e90d Fix-up file to media calls from edit (from 3d72c10) 2019-03-12 22:18:57 +01:00
Сергей Прохоров
43505e0aad
Use issubclass instead of direct class comparison 2019-03-12 20:25:33 +01:00
Сергей Прохоров
fef580c24b
Revert non-related change 2019-03-12 01:28:59 +01:00
Сергей Прохоров
4696dfc25e
Rework class hierarchy, try to DRY more 2019-03-12 01:12:55 +01:00
Lonami Exo
916b379c03 Work around message edits arriving too early in conversations 2019-03-11 13:03:10 +01:00
Lonami Exo
1b703e905c Don't set self._state when checking if logged in
This essentially made catch_up useless after .start().
cc #1125 since this affects catch_up.
2019-03-11 09:04:08 +01:00
Lonami Exo
8884015dae Clarify some docstrings 2019-03-10 13:29:34 +01:00
Сергей Прохоров
b873aa67cc
Implement different mtproto proxy protocols; refactor obfuscated2 2019-03-10 03:26:24 +01:00
Lonami Exo
baa8970bb6 Fix handling message payloads that are too large 2019-03-06 18:08:51 +01:00
Lonami Exo
3d72c10ea5 Reduce calls to utils.is_image 2019-03-06 09:38:17 +01:00
Lonami Exo
758556cd30 Fix upload_file not seeking streams back
This would cause issues in _cache_media since utils.is_image fails
in the second pass (it respects the stream's position, and the user
may rightfully pass a stream that should be read only from one pos).
2019-03-06 09:24:50 +01:00
Lonami Exo
fcfebf75a3 Prevent pillow from closing non-exclusive fps (#1121) 2019-03-06 09:14:06 +01:00
Lonami Exo
ae8f1fed05 Treat arguments with _until or _since in their name as dates 2019-03-06 08:38:21 +01:00
Lonami Exo
0f69455dc7 Handle hachoir metadata more gracefully, bump 1.6.2
Since bf11bbd _get_extension supports plenty more things,
which hachoir cannot deal with. Add some extra safety checks.
2019-03-04 08:58:32 +01:00
Lonami Exo
6799295115 Fix iter_participants in non-channels 2019-03-02 21:17:36 +01:00
Lonami Exo
4cc2a17765 Deal with usability in methods that hit flood wait 2019-03-02 19:40:39 +01:00
Lonami Exo
dd1ca16ded Update docs, usability and errors for all methods 2019-03-02 19:01:20 +01:00
Wirtos
c4d65f8bf4 ValueError fix for IOBase files (#1119) 2019-03-01 21:27:15 +01:00
Lonami Exo
df534585e9 Actually fix ids= not being a list, bump 1.6.1 2019-02-28 08:31:28 +01:00
Lonami Exo
2681dc09bb Fix iter_messages with ids= not being a list 2019-02-28 08:26:37 +01:00
Manuel1510
70e0d865a8 Fix RequestIter.__next__ propagating StopAsyncIteration (#1117) 2019-02-28 08:07:31 +01:00
Lonami Exo
8429f9bd3c Update to v1.6 2019-02-27 21:04:18 +01:00
Lonami Exo
934c733ccb Treat users "kicking themselves" as leaving (#1116) 2019-02-27 19:42:17 +01:00
Lonami Exo
05d174d4ce Update documentation, errors and add TODOs 2019-02-27 19:30:12 +01:00
Lonami Exo
f66d65d409 Add RequestIter._next__ for synchronous iteration 2019-02-27 16:13:11 +01:00
Lonami Exo
6b50152bb3 Use constants for chunk sizes, remove irrelevant TODO 2019-02-27 13:07:25 +01:00
Lonami Exo
d02d0e2d5e Handle negative limits gracefully in async generators
We rely on >= 0 for setting the batch size to use (which must
be valid), so it makes sense to make negative limits equal 0.

This is similar to how asyncio.sleep(negative) sleeps 0 seconds,
despite the fact that time.sleep(negative) fails.
2019-02-27 13:01:04 +01:00
Lonami Exo
d508e58d49 Remove the "private" _total parameter 2019-02-27 12:59:50 +01:00
Lonami Exo
bf71e49fcc Remove batch_size parameter from iter_messages
It was only useful for testing purposes, and no other methods
exposed this kind of parameter (but they still use it).
2019-02-27 12:57:54 +01:00
Lonami Exo
b9133567af Remove weird map chr range from aggressive iter_participants 2019-02-27 12:51:09 +01:00
Lonami
c99157ade2
Merge pull request #1115 from LonamiWebs/requestiter
Overhaul asynchronous generators
2019-02-27 12:49:12 +01:00
Lonami Exo
c73b8eda26 Simplify filling RequestIter's buffer 2019-02-27 11:25:35 +01:00
Lonami Exo
202ce1f494 Remove async_generator from dependencies 2019-02-27 11:13:29 +01:00
Lonami Exo
40ded93c7c Use RequestIter in chat methods 2019-02-27 11:12:05 +01:00
Lonami Exo
4f647847e7 Fix RequestIter not setting TotalList.total in collect() 2019-02-27 10:39:56 +01:00
Lonami Exo
968da5f72d Use RequestIter in the dialog methods 2019-02-27 10:38:50 +01:00
Lonami Exo
49d8a3fb33 Remove code to syncify async generator functions 2019-02-27 10:19:08 +01:00