Commit Graph

3050 Commits

Author SHA1 Message Date
Lonami Exo
8d98c04932 Fix awaits on input_chat property 2018-06-22 10:05:29 +02:00
Lonami Exo
f733f8e565 Rewrite the first part of the docs for asyncio 2018-06-21 21:54:54 +02:00
Lonami Exo
5e322a6ca9 Remove async properties from custom.Message
Awaiting on a property was strange and only really made sense
in events.NewMessage. Methods like client.get_messages() and
similar return entire custom.Message which won't need to touch
the network, and requiring the await was a poor UX.
2018-06-21 21:15:48 +02:00
Lonami Exo
3973755333 Support .name attr in utils.is_type/client.upload_file
This means open()'ed files will have their name used properly,
and that you can set b.name = 'somename.jpg' to io.BytesIO()
objects to have them uploaded as images.
2018-06-21 16:31:03 +02:00
Lonami Exo
d8af64e3b9 Clarify/fix get[_input]_entity docstrings 2018-06-21 11:08:14 +02:00
Lonami Exo
777c91ee14 Fix setup.py 2018-06-21 10:48:47 +02:00
Lonami Exo
5c602d4ba7 Add __str__ to RpcResult/GzipPacked 2018-06-21 09:58:12 +02:00
Lonami Exo
a99fce471a Fix cancelling a None handle on first connection+error 2018-06-21 09:48:11 +02:00
Lonami Exo
cfa5cd0db2 Fix is_user_authorized always returning True 2018-06-21 09:32:09 +02:00
Lonami Exo
8d5c052fce Fix TypeError when accessing unexisting sender 2018-06-21 09:26:31 +02:00
Lonami Exo
d6818f25f5 Fix rare iter_dialogs infinite loop 2018-06-20 21:12:47 +02:00
Lonami Exo
9c0a22ddd7 Fix Python 3.5 compatibility 2018-06-20 20:18:16 +02:00
Lonami Exo
9e3f6483e8 Fix pattern= and move pattern_match to events.NewMessage 2018-06-20 20:03:44 +02:00
Lonami Exo
a1477a84bf Update in-memory updates.State 2018-06-20 19:58:01 +02:00
Lonami Exo
4ab5c7d92d Fix reconnect sentinel when not reconnecting in send_loop
It would cause issues with the debug logs, since it assumes it's
a TLMessage, which have an .obj attribute. Second, the send_loop
is also smarter regarding reconnects (since OSError often occur
due to not being connected at all, namely ConnectionResetError).
2018-06-20 18:19:57 +02:00
Lonami Exo
c8ee0bdca9 Fix socket may be None when closing twice 2018-06-20 17:59:11 +02:00
Lonami Exo
a0eb824e87 Support ignore_migrated in iter_dialogs 2018-06-20 12:03:42 +02:00
Lonami Exo
c893eaaa84 Allow filtering new messages by sender/forwards 2018-06-20 11:58:44 +02:00
Lonami Exo
ad1ab64415 Save last ack to resend in case of bad salt 2018-06-20 11:12:04 +02:00
Lonami Exo
c85ba4accc Revisit documentation, cross-references and unnecessary indents 2018-06-20 11:06:03 +02:00
Lonami Exo
1b7e7320a4 Clean-up documentation and include telethon.client 2018-06-19 21:24:26 +02:00
Lonami Exo
4e9a84c3b5 Remove underscore from module names 2018-06-18 21:02:42 +02:00
Lonami Exo
262018959f Process entities from sent requests/updates 2018-06-18 20:44:20 +02:00
Lonami Exo
fbf3bf119c Separate errors needing regex from those which don't 2018-06-18 19:09:45 +02:00
Lonami Exo
463847ad50 Revisit and remove a few TODOs 2018-06-18 18:46:06 +02:00
Lonami Exo
ebfe8ebf40 Configurable per-client request/connection retries 2018-06-18 18:13:00 +02:00
Lonami Exo
09ea1179ca Except msg_id KeyError on bad salt/msg 2018-06-18 17:20:31 +02:00
Lonami Exo
3648f7c756 Log outgoing message types and incoming message IDs 2018-06-18 17:14:04 +02:00
Lonami Exo
51d8ea0fa8 Shield disconnected Future in the MTProtoSender instead 2018-06-18 15:55:24 +02:00
Lonami Exo
efc48ee3b0 Shield self.disconnected and log RpcCallFail 2018-06-18 14:28:30 +02:00
Lonami Exo
ee7a44d447 Return an empty list from get_entities_text if no entities 2018-06-18 13:54:09 +02:00
Lonami Exo
3c1d7d2da2 Fix MessageEmpty when searching for messages 2018-06-18 13:48:50 +02:00
Lonami Exo
7641ba2d32 Fix sleep on the wrong indent and handle CancelledError
This was causing a huge slow-down every time a request was
received delaying all the subsequent incoming messages too
2018-06-18 13:29:12 +02:00
Lonami Exo
374f5e2aab Periodically send ping/getState 2018-06-18 13:22:25 +02:00
Lonami Exo
94d6c339c4 Add more logging in the MTProtoSender 2018-06-18 11:29:54 +02:00
Lonami Exo
e36aff51dd Raise ConnectionError when sending without connection
Otherwise the program could potentially block on await client(...)
since this has no timeout (unless asyncio.wait_for() was used) and
would give no further hint that the program was halted there.
2018-06-17 20:25:22 +02:00
Dan Elkouby
d5b349e031 Implement a mechanism to notify of connection failures (#852) 2018-06-17 19:29:41 +02:00
Lonami Exo
d9d586171f Fix MTProtoSender should not send content-related queries 2018-06-17 16:23:22 +02:00
Lonami Exo
145d4b7105 Remove socket fd from the loop reader upon closing 2018-06-17 15:48:26 +02:00
Lonami Exo
aaa7ec757b Support start() retrying on PasswordHashInvalidError 2018-06-17 14:07:45 +02:00
Lonami Exo
4d1272f1d2 Fix __ is invalid in usernames (cc @Kyle2142) 2018-06-17 12:08:55 +02:00
Lonami Exo
b65cbd8647 Validate to_id when iterating over messages by ID 2018-06-17 11:57:11 +02:00
Lonami Exo
226c35ff8f Pump up default timeout from 5 to 10s 2018-06-17 11:46:56 +02:00
Lonami Exo
d18ee9ecc5 Handle (re)connection errors more gracefully 2018-06-17 11:41:35 +02:00
Lonami Exo
9c63def14c Fix docs' typos 2018-06-16 21:51:13 +02:00
Lonami Exo
8086772506 Make sure not to include sentinel in containers 2018-06-16 18:40:08 +02:00
Lonami Exo
bb2cacd525 Fix automatic reconnection by unblocking the send queue 2018-06-16 18:34:36 +02:00
Lonami Exo
56ddaaee6f Make non-fwded messages sent to yourself outgoing 2018-06-16 17:35:24 +02:00
Lonami Exo
7cfecfaf21 Support pathlib.Path on download/upload 2018-06-16 17:01:20 +02:00
Lonami Exo
cbd5594dba Use the correct clock time when sleeping on iter_messages 2018-06-15 17:09:16 +02:00