Commit Graph

121 Commits

Author SHA1 Message Date
Lonami Exo
4fd9d361f0 Replace redundant isinstance calls with a tuple parameter 2017-10-13 11:39:34 +02:00
Lonami Exo
9cf5506ee4 Don't .disconnect() on FloodWaitError
Since other requests can still be invoked, it makes no
sense to call .disconnect().
2017-10-13 09:59:37 +02:00
Lonami Exo
db623e37fd Except ConnectionResetError on ._reconnect (fix #309) 2017-10-09 13:23:39 +02:00
Lonami Exo
a7622324dd Remove unnecessary offset_index variable on .download_file 2017-10-09 12:00:14 +02:00
Lonami Exo
6f1c05633e Join all threads when calling .disconnect() (fix #252) 2017-10-09 11:47:10 +02:00
Lonami Exo
f984aae391 Except ProxyConnectionError on ReadThread (fix #307) 2017-10-09 11:37:08 +02:00
Lonami Exo
15e90dcb69 Allow specifying a threshold to handle flood waits 2017-10-08 16:15:30 +02:00
Lonami Exo
62aec947c0 Chang auto-reconnect condition (fix #303) 2017-10-08 10:52:56 +02:00
Lonami Exo
244a47cddd Fix consuming all retries on Requests returning False/empty list 2017-10-07 18:54:30 +02:00
Joscha Götzer
7b5d409c49 Warn users on .add_update_handler if no workers are running (#300) 2017-10-07 17:55:37 +02:00
Lonami Exo
1d8a02685f Update to v0.15.1 2017-10-05 13:58:26 +02:00
Lonami Exo
a98dc9d95b Try passing socks.GeneralProxyError to the main thread 2017-10-04 14:09:46 +02:00
Lonami Exo
d98fd6a424 Fix workers not stopping on .disconnect(), start them on login 2017-10-01 19:56:24 +02:00
Lonami Exo
e717256937 Always use session ip address and port when connecting 2017-10-01 19:26:20 +02:00
Lonami Exo
8c3a2470ed Update to v0.15 2017-10-01 17:38:48 +02:00
Lonami Exo
c61e168de4 Rename invoke to __call__ 2017-10-01 16:04:14 +02:00
Lonami Exo
36dabc4928 Process entities from the MtProtoSender instead TelegramBareClient
This way, update objects will also be processed when they occur.
2017-10-01 16:02:29 +02:00
Lonami Exo
a737f33324 Save all found entities to the session file 2017-10-01 13:27:08 +02:00
Lonami Exo
1d159908c7 Fix RPC excepts (e.g. UserMigrate) being in the wrong try 2017-10-01 11:25:56 +02:00
Lonami Exo
a5ab49c707 Remove sleep on ServerError as per @danog's recommendation 2017-09-30 19:02:12 +02:00
Lonami Exo
c9dff552b8 Except ServerErrors and sleep a bit before retrying 2017-09-30 18:51:25 +02:00
Lonami Exo
76e5206acc Raise ValueError if an unknown **kwarg is given 2017-09-30 18:45:56 +02:00
Lonami Exo
8c3c990e74 Remove UpdateState .set and .check error 2017-09-30 18:39:31 +02:00
Lonami Exo
933ae01d85 Change condition to perform automatic reconnection 2017-09-30 18:33:34 +02:00
Lonami Exo
b6bc9ac39b Rename ._connect_lock to ._reconnect_lock 2017-09-30 18:25:09 +02:00
Lonami Exo
4cd7e1711e Rename cdn parameter to _cdn 2017-09-30 17:57:39 +02:00
Lonami Exo
d28f370ab6 Add ._get_cdn_client as alternative ._get_exported_client version 2017-09-30 17:51:07 +02:00
Lonami Exo
a35c4b15db Cache exported Sessions instead whole clients 2017-09-30 16:32:10 +02:00
Lonami Exo
c1c6df9fd0 Fix invoke not raising ValueError when retries reach 0 2017-09-30 16:18:16 +02:00
Lonami Exo
8ecd2c2e06 Call .sync_updates on .connect iff exported_auth is None
Calling this method on exported clients would trigger a
UserMigrateError because it was being used on a non-native
data center. For .connects like this, don't attempt syncing
updates.
2017-09-30 16:11:16 +02:00
Lonami Exo
18e485ded2 Set default TelegramBareClient behaviour to not spawn ReadThread 2017-09-30 15:53:47 +02:00
Lonami Exo
0a567fcd7c Make creating a new sender cleaner 2017-09-30 12:08:06 +02:00
Lonami Exo
003e231239 Attempt at cleaning up TelegramBareClient.invoke() 2017-09-30 11:45:35 +02:00
Lonami Exo
61033b2f56 Allow disabling spawning a second thread 2017-09-30 11:28:15 +02:00
Lonami Exo
7cef5885fa Rename process_updates/polling to workers 2017-09-30 11:17:31 +02:00
Lonami Exo
9560bcc324 Remove "if background thread" check as it isn't exposed anymore 2017-09-30 10:27:46 +02:00
Lonami Exo
479afddf50 Move core functionality to the TelegramBareClient
Rationale: the intended behaviour of the TelegramClient will now
be to focus on abstracting the users from manually importing
requests and types to work with Telegram's API. Thus, all the
core functionality has been moved to the TelegramBareClient,
which will now be responsible of spawning new threads or
connections and even handling updates.

This way there is a clear distinction between the two clients,
TelegramClient is the one meant to be exposed to the end user,
since it provides all the mentioned abstractions, while the
TelegramBareClient is the "basic" client needed to work with
the API in a comfortable way.

There is still a need for an MtProtoSender, which still even
lower level, and knows as little as possible of what requests
are. This handles parsing the messages received from the
server so that their result can be understood.
2017-09-30 10:27:46 +02:00
Lonami Exo
0a693c705a Create a new connection when called from a different thread
This allows to invoke several requests in parallel while not
waiting for other requests to be written to the network.
2017-09-30 10:27:46 +02:00
Lonami Exo
61e5c73658 Update to v0.14.2 2017-09-29 13:13:05 +02:00
Lonami Exo
dc5bbc1719 Update to v0.14.1 2017-09-28 12:02:47 +02:00
Lonami Exo
b0839a028e Update to v0.14 2017-09-27 13:51:59 +02:00
Lonami Exo
f233110732 Allow sending several requests at once through new MessageContainer 2017-09-25 20:52:27 +02:00
Lonami Exo
0f10e1419f Update to v0.13.6 2017-09-23 11:44:04 +02:00
Lonami Exo
f39f9c33a0 Fix timeout on confirm_received.wait not being added (fix #257) 2017-09-22 19:20:37 +02:00
Lonami Exo
9ce4307304 Update to v0.13.5 2017-09-22 16:12:43 +02:00
Lonami Exo
b0f6b23e52 Fix creating new connections accessing invalid attributes 2017-09-22 16:11:07 +02:00
Lonami Exo
d8bf8bb2eb Fix reconnect always returning False -> infinite loop 2017-09-22 12:48:04 +02:00
Lonami Exo
4d5f16f2aa Fix background thread could not reconnect properly 2017-09-22 12:44:09 +02:00
Lonami Exo
4245ec5abc Make reconnect private 2017-09-22 12:31:41 +02:00
Lonami Exo
bc15b451b5 Use a safer reconnect behaviour (respect multithread too) 2017-09-22 12:20:38 +02:00