Commit Graph

300 Commits

Author SHA1 Message Date
Lonami Exo
12c12fdfaf Fix representing .stringify() for bytes with indent > 0 2017-09-17 16:35:35 +02:00
Lonami Exo
76b7420b63 Ignore TimeoutError when invoking a request 2017-09-17 16:32:51 +02:00
Lonami Exo
2f0f6d4591 Remove initial_query leftovers 2017-09-17 16:20:04 +02:00
Lonami Exo
aea10b103b Rename generated layer variable to uppercase readonly property 2017-09-17 16:17:55 +02:00
Lonami Exo
c84e54b647 Get rid of the initial_query= parameter on .connect() 2017-09-17 16:06:43 +02:00
Lonami Exo
2689b0750d Make DC options static
Some datacenters don't allow calling GetConfigRequest,
this way it can both be reused and such calls omitted.
2017-09-17 15:19:21 +02:00
Lonami Exo
59a4315c28 Avoid calling InitConnectionRequest when it's not needed 2017-09-17 14:26:25 +02:00
Lonami Exo
29471f3bba Force obfuscated2 mode if api_id < 20 2017-09-15 11:49:39 +02:00
Lonami Exo
279eb110be Update to v0.13.3 2017-09-14 11:51:41 +02:00
Lonami Exo
12a39873f1 Workaround msg_seqno too low/high (closes #95) 2017-09-14 11:50:38 +02:00
Lonami Exo
151e1623d3 Stop saving the session ID, sequence and time offset
After some discussion, storing the session ID is not needed at all.
It can always start off as a new random 8-byte-long number, also
restarting the sequence number at 0. This should prevent some seqno
too low errors.

Also, saving the time offset could cause more trouble than fixing
them, so that has also been removed.
2017-09-14 11:44:42 +02:00
Lonami Exo
73fe7258d1 Modify .send_message to return the sent message object 2017-09-13 12:00:27 +02:00
Lonami Exo
d12fb5b924 Add an optional reply_to parameter to .send_message/media 2017-09-13 11:51:23 +02:00
Lonami Exo
7043f4c9ba Add a convenience method to send voice notes 2017-09-13 11:30:20 +02:00
Lonami Exo
d79dccc923 Add a lock around TcpClient.close() to try avoiding None.close() 2017-09-13 09:44:58 +02:00
Lonami Exo
1d36bbfbf4 Remove forgotten invalid code CdnDecrypter.finish_check (fix #243) 2017-09-12 15:38:00 +02:00
Lonami Exo
a76c31ede2 Add lru_cache decorator to .get_entity() 2017-09-11 12:53:39 +02:00
Lonami Exo
83f9cafabf Make .get_entity() public 2017-09-11 11:54:32 +02:00
Lonami Exo
188b1c8816 Fix client reconnection not actually working 2017-09-11 11:38:36 +02:00
Lonami Exo
a2fdd4b196 Ignore InvalidChecksumError's 2017-09-11 11:04:19 +02:00
Lonami Exo
48dead76ac Retry up to five times before giving up on a request 2017-09-11 10:52:36 +02:00
Lonami Exo
bce88446ef Fix incorrect condition causing updates to be ignored 2017-09-08 18:43:37 +02:00
Lonami Exo
54ba0661c6 Fix wrong variable name causing .connect() to fail 2017-09-08 18:28:31 +02:00
Lonami Exo
fa4042a80e Update to v0.13.2 2017-09-08 13:22:05 +02:00
Lonami Exo
c81537bed0 Simplify the workflow with UpdateState exposing a single flag param 2017-09-08 12:54:38 +02:00
Lonami Exo
25bbb20b0c Use RLocks properly on MtProtoSender (only needed on net IO) 2017-09-07 21:32:46 +02:00
Lonami Exo
16a5ab3070 Add back the periodic PingRequest 2017-09-07 21:23:37 +02:00
Lonami Exo
a24b4020fe Allow adding update handlers without the need to poll updates 2017-09-07 20:29:51 +02:00
Lonami Exo
b8e881b6b6 Add basic updates processing to ignore updates with lower .pts 2017-09-07 20:17:40 +02:00
Lonami Exo
d237375208 Allow adding callback methods to UpdateState 2017-09-07 18:58:54 +02:00
Lonami Exo
d4f36162cd Create and use UpdateState to .process() unhandled TLObjects 2017-09-07 18:49:08 +02:00
Lonami Exo
49e884b005 Raise AssertionError if trying to invoke requests from ReadThread 2017-09-07 18:48:41 +02:00
Lonami Exo
06b2834c02 Fix GetContactsRequest using str instead int (layer 70->71) (#234) 2017-09-07 10:45:55 +02:00
Birger Jarl
edf325d580 Fix username regex (#235)
Username max length is 1+31 = 32
2017-09-07 09:41:49 +02:00
xkdnyan
cd40f4a949 Add RPCError for MESSAGE_NOT_MODIFIED (#231) 2017-09-05 17:06:35 +02:00
Lonami Exo
49555ad018 Stick to the offset and limit CdnFileHashes dictates (#222)
The old intersection method and allowing an arbitrary part size
wasn't working properly. Assuming that Telegram will send a sha
sum for the whole file, in the correct order, we can simply use
their offsets to download the file.
2017-09-05 16:43:53 +02:00
Lonami Exo
2924912931 Fix CDN downloads not always calling GetCdnConfigRequest (#222)
On previous tests, Telegram didn't return information about CDNs
on the initial GetConfigRequest. However, it may do so, and it's
necessary to call GetCdnConfigRequest even when a second call to
GetConfigRequest isn't required.
2017-09-05 16:11:02 +02:00
Lonami Exo
d5cd59de8a Update to v0.13.1 2017-09-04 20:34:05 +02:00
Lonami Exo
a38381665c Support invoking requests from within the ReadThread (fixes #226) 2017-09-04 20:28:41 +02:00
Lonami Exo
fe86b88bef Make .sign_up() return the logged user just like .sign_in() 2017-09-04 18:07:20 +02:00
Lonami Exo
15fd5390ae Optimize imports 2017-09-04 17:18:33 +02:00
Lonami Exo
97cab7347b Make lint happier 2017-09-04 17:10:04 +02:00
Lonami Exo
7f700c3bc1 Remove unused attributes and methods from the base TLObject class 2017-09-04 16:39:16 +02:00
Lonami Exo
dc238df2e0 Update to v0.13 2017-09-04 12:18:45 +02:00
Lonami Exo
6f0bd14c2f Use an Enum for the ConnectionMode and support specifying it 2017-09-04 11:24:10 +02:00
Lonami Exo
62a52679f4 Ensure the state of the requests is clean before invoking them 2017-09-03 13:45:13 +02:00
Lonami Exo
27408b46da Only reconnect from background thread if .disconnect wasn't called 2017-09-03 13:44:52 +02:00
Lonami Exo
626778bd32 Ignore EBADF when closing the socket 2017-09-03 13:44:29 +02:00
Lonami Exo
68cdc9eaf1 Treat OSError.errno == EBADF as a ConnectionResetError 2017-09-03 11:54:26 +02:00
Lonami Exo
f8f389c850 Fix ack requests removing pending requests when they shouldn't 2017-09-03 11:21:42 +02:00