Commit Graph

733 Commits

Author SHA1 Message Date
Andrey Egorov
7c0af2c080 Another attempt to prevent duplicates 2017-12-09 21:24:13 +03:00
Andrey Egorov
984f483b98 Handle updates and other refactoring 2017-12-03 02:31:43 +03:00
Andrey Egorov
004c92edbe SocketClosed exception 2017-11-19 13:04:40 +03:00
Andrey Egorov
32bca4f1b8 Refactoring of TcpClient 2017-11-19 01:55:40 +03:00
Andrey Egorov
653dd21259 Socket OSError logging 2017-11-16 17:31:39 +03:00
Andrey Egorov
2efcfbd416 More aggressive catching network errors 2017-11-16 02:56:57 +03:00
Andrey Egorov
3111153822 No route to host catched + other errno to reconnect 2017-11-15 14:19:01 +03:00
Andrey Egorov
25af22f1e7 Bugfix in reconnection 2017-11-14 14:07:40 +03:00
Andrey Egorov
5e172053da Merge remote-tracking branch 'upstream/asyncio' into asyncio 2017-10-30 00:29:46 +03:00
Lonami Exo
23b5a9d1f6 Merge branch 'master' into asyncio 2017-10-29 20:08:32 +01:00
Andrey Egorov
cb2d943139 Remove forgotten points 2017-10-29 15:33:03 +03:00
Lonami Exo
e48f15be80 Fix-up af08d59 (missing parenthesis) 2017-10-28 11:11:51 +02:00
Lonami Exo
2f28050cac Fix generated __bytes__ failing with flag indicator but no flags
Likely since the code was ported to get rid of the BinaryWriter,
since the flag calculation was inlined. Some types (only
channelMessages as of layer 71) had a flag indicator but no flag
arguments, so the calculation of which were not None failed.

This special case is now handled correctly.
2017-10-28 11:09:55 +02:00
Tanuj
af08d59cb7 Fix bug with semicolons when downloading contacts (#319) 2017-10-28 11:09:46 +02:00
Lonami
6dc0ee9d6c
Merge pull request #370 from andr-04/asyncio
Made update system for asyncio functional
2017-10-28 11:07:41 +02:00
Tanuj
39a1d5e90d Replace broken auto_replier.py with new code (#389) 2017-10-28 11:06:34 +02:00
Tanuj
403c7bd00a Make pylint happier on print_updates example (#387) 2017-10-26 18:03:24 +02:00
Andrei Fokau
e6ac61c1b9 Add missing __init__.py to telethon_generator package (#382) 2017-10-25 19:48:46 +02:00
Lonami Exo
c6d30ffceb Fix exception when logging exceptions 2017-10-25 13:06:51 +02:00
Lonami Exo
3db13ccdd2 Add a more descriptive error when serializing bytes 2017-10-25 12:43:57 +02:00
Lonami Exo
e427559d4c Fix username invalid error having wrong username regex 2017-10-25 12:22:38 +02:00
Tanuj
9f9da6adda Remove comma (#376) 2017-10-24 22:08:44 +02:00
Tanuj
d707fd1593 Add example script to print out all updates 2017-10-24 21:32:31 +02:00
Lonami Exo
ceb37cd4c5 Move auth_key generation and InitConnection logic to .invoke()
The reasoning behind this is that .connect() should not call
any request at all, it should only connect to the servers
although it currently still calls GetStateRequest.

There were some issues (#291, #360) where the auth_key was None
(possibly due to .connect() returning False), so this may
fix some of the cases where it returned False. This way we also
ensure that we always have an auth_key, or even if it "breaks"
(it's not the right key for the server anymore).

A few additional changes have been introduced to accommodate
this, such as moving InitConnection logic too or importing auths.
2017-10-24 15:40:51 +02:00
Lonami Exo
b3ca68b7d9 Avoid cyclic imports caused by #348 (fix #357) 2017-10-24 10:07:31 +02:00
Lonami Exo
d58c729af0 Add missing InputPeerSelf case to .get_input_user 2017-10-24 09:43:59 +02:00
Lonami Exo
8bd578711c Revert "no more retries" exception 2017-10-23 10:05:15 +02:00
Lonami Exo
3a7fa249a4 Revert None result checks on the TelegramClient 2017-10-22 20:30:55 +02:00
Lonami Exo
48ec0319d2 Merge branch 'asyncio' of LonamiWebs/Telethon into asyncio 2017-10-22 20:10:25 +02:00
Lonami Exo
ffaa3ac064 Remove unused timeout variable from the TelegramClient 2017-10-22 19:47:24 +02:00
Lonami Exo
30ac6789ce Change _set_connected_and_authorized condition 2017-10-22 19:27:49 +02:00
Lonami Exo
1a0d5e75bf Make use of more constants in the TcpClient 2017-10-22 19:13:45 +02:00
Andrey Egorov
780e0ceddf Update handlers works; it also seems stable 2017-10-22 15:06:36 +03:00
Lonami Exo
1f1e040af9 Fix setup.py if/elif/else chain 2017-10-22 13:57:02 +02:00
Lonami Exo
b04eed82eb Add new .idle() method to listen for updates from MainThread 2017-10-22 13:16:34 +02:00
Andrey Egorov
8057cea294 Fix resending requests on bad salt/msg notification (#369)
These responses from the server could indicate container IDs,
which weren't being saved. This fix also accounts for that case.
2017-10-22 13:13:49 +02:00
Lonami Exo
5de8350d85 Reorder another import for #357 2017-10-22 11:23:15 +02:00
Lonami Exo
5f0faee013 Attempt at fixing redundant import from ee01724 (#357) 2017-10-22 11:12:42 +02:00
Lonami Exo
6759beac21 Add __str__ methods to TLMessage and MessageContainer 2017-10-21 20:23:53 +02:00
Lonami Exo
d7f917ebfc Update docstrings 2017-10-21 16:59:20 +02:00
Lonami Exo
f6223bd01a Document the InteractiveTelegramClient more nicely 2017-10-21 16:21:58 +02:00
Lonami Exo
335bc6a789 Merge branch 'master' into asyncio 2017-10-21 15:45:56 +02:00
Lonami Exo
7596f2b797 Fix and enhance "no workers set" warning 2017-10-21 13:48:57 +02:00
Joscha Götzer
9937d58a2d Remove f-strings from codegen to support py <3.6 (#366) 2017-10-21 00:43:26 +02:00
Lonami Exo
5cdf92e509 Update to v0.15.3 2017-10-20 23:33:08 +02:00
Lonami Exo
d70811b693 Fix infinite loop when invoking on update handlers (fix #336)
Every update that hadn't been acknowledged on the main connection
yet would be resent on any new connection. These new connections
are made temporary when invoking anything from any thread that's
not the main thread. It would also process all the updates, hence,
Telegram would be resending these not-acknowledged updates to the
temporary connection, and the updates would be processed again,
then the update handler would react to the duplicated updates over
and over.

To fix this, simply don't process updates on the temporary thread
at all. With this reasoning, if we don't acknowledge updates on
the temporary connections, Telegram will resend them on the main
connection, so we should not lose any.
2017-10-20 23:30:02 +02:00
Lonami Exo
2782a08ed0 Add note for future self when handling gzip packed data 2017-10-20 22:44:00 +02:00
Lonami Exo
1a91c024fc Revert 63dfb1e as many updates were being dropped 2017-10-20 22:12:03 +02:00
Lonami Exo
033119e9b8 Make MtProtoSender._need_confirmation a set
This will avoid adding duplicated items to it
2017-10-20 22:07:45 +02:00
Lonami Exo
83595a0e2d Use more constants in setup.py 2017-10-20 17:32:30 +02:00