Commit Graph

16 Commits

Author SHA1 Message Date
Dmitry D. Chernov
f99d14558f binary_reader: Parse TL 'date' to UTC datetime instead of local 2017-11-23 02:06:43 +10:00
Lonami Exo
3db13ccdd2 Add a more descriptive error when serializing bytes 2017-10-25 12:43:57 +02:00
Lonami Exo
adb79b21cf Replace .to_bytes() with the special .__bytes__ function 2017-10-17 19:54:59 +02:00
Lonami Exo
1f54cbfb5a Make str(TLObject) return valid code to generate it back 2017-10-08 17:51:29 +02:00
Lonami Exo
91a5d20e93 Replace .on_response with static .from_reader for all types 2017-10-07 13:26:09 +02:00
Lonami Exo
afc4bd9cab Rename constructor/subclass_of_id to upper case, keep only static 2017-09-29 13:11:33 +02:00
Lonami Exo
fb0898b9cb Don't distinguish between str and bytes when serializing
This makes it easier to use some requests like ReqPqRequest which
needs a string of bytes, not a valid utf-8 string per se.
2017-09-28 09:55:29 +02:00
Lonami Exo
98c2e1dd4f Replace 4 .append calls with a single one when serializing bytes 2017-09-26 14:41:11 +02:00
Lonami Exo
b83cd98ba0 Replace TLObject.on_send with the new .to_bytes()
This also replaces some int.to_bytes() calls with a faster
struct.pack (up to x4 faster). This approach is also around
x3 faster than creating a BinaryWriter just to serialize a
TLObject as bytes.
2017-09-26 14:36:02 +02:00
Lonami Exo
80e9877256 Show the type of children TLObjects on .stringify() 2017-09-23 11:01:25 +02:00
Lonami Exo
12c12fdfaf Fix representing .stringify() for bytes with indent > 0 2017-09-17 16:35:35 +02:00
Lonami Exo
15fd5390ae Optimize imports 2017-09-04 17:18:33 +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
863d2e8368 Make confirm_received a flag, avoid race conditions, fix bg RPCError
There was a race condition between TelegramBareClient.invoke
receiving part and MtProtoSender._handle_rpc_result actually
reading the result after setting request.confirmed = True.

The .confirmed is now a threading.Event to avoid the sleep(0.1).

RPC errors have been moved inside the request so they're not
raised on a background thread anymore.
2017-09-02 20:41:00 +02:00
Lonami Exo
2517b9787d TLObject.stringify() was showing bytes as lists 2017-08-24 20:56:08 +02:00
Lonami Exo
160a3699ac Fix confusing names "MtProtoRequest" and ".confirmed" (#176)
This also fixes the annoyingly confusing message:
"Odd msg_seqno expected (relevant message), but even received."
2017-07-24 16:54:48 +02:00