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
Lonami Exo
4ba12e717f
Fix reconnect to new_dc wasn't changing connection.ip
2017-09-21 13:58:57 +02:00
Lonami Exo
2b2da843a1
Create a Connection only once and avoid no-op if was "connected"
2017-09-21 13:44:22 +02:00
Lonami Exo
e12e82357d
Update to v0.13.4
2017-09-18 13:32:16 +02:00
Lonami Exo
e7a936222f
Catch -404 BrokenAuthKeyError on .connect()'s .do_authentication
2017-09-17 18:38:03 +02:00
Lonami Exo
58fe39f060
Expose MtProtoSender.is_connected() and use it on .connect()
2017-09-17 16:39:29 +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
1d36bbfbf4
Remove forgotten invalid code CdnDecrypter.finish_check ( fix #243 )
2017-09-12 15:38:00 +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
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
a24b4020fe
Allow adding update handlers without the need to poll updates
2017-09-07 20:29:51 +02:00
Lonami Exo
d4f36162cd
Create and use UpdateState to .process() unhandled TLObjects
2017-09-07 18:49:08 +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
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
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
4de4026bb3
Move the "constant read" thread to the main TelegramClient
2017-09-03 09:56:10 +02:00
Lonami Exo
9bc1f64efe
Move update handling to the MtProtoSender, being functional again
2017-09-02 21:46:44 +02:00
Lonami Exo
21eaf8bd72
Allow setting whether the MtProtoSender should use constant_read
2017-09-02 21:27:11 +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
b908296efa
Remove unused TcpClien.read(timeout=...) param, change other accessors
2017-09-02 19:33:42 +02:00
Lonami Exo
43b79c3d36
Add a thread to constantly read messages from the network
2017-09-02 18:27:22 +02:00
Lonami Exo
22673aec0e
Replace the old Session+pickle with JsonSession (name change)
2017-08-29 15:59:08 +02:00
Lonami Exo
82304b18eb
Attempt at supporting IPv6 ( #211 and #112 )
2017-08-29 13:49:41 +02:00
Lonami Exo
fa22a3f848
Create a centralized Connection class, replaces TcpTransport ( #112 )
2017-08-28 21:23:31 +02:00
Lonami Exo
2c6377e069
Update to v0.12.2
2017-08-28 17:29:08 +02:00
Lonami Exo
06b2d5d786
Fix CDN client not being disconnected
2017-08-28 16:33:23 +02:00
Lonami Exo
8afcd0b91f
Turn HashChecker into CdnDecrypter to abstract CDN-specific aspects
2017-08-28 16:25:10 +02:00
Lonami Exo
b504ce14bc
Verify the files downloaded from CDNs and raise on sha256 mismatch
2017-08-28 14:17:31 +02:00
Lonami Exo
2e55998d7f
Update to v0.12.1
2017-08-24 19:09:37 +02:00
Lonami Exo
4384ccb132
Tidy up TelegramBareClient.download_file CDN's mess
2017-08-24 18:00:47 +02:00
Lonami Exo
e5e7715a31
Decrypt files downloaded from CDNs ( closes #208 )
2017-08-24 15:50:44 +02:00
Lonami Exo
940a2896e8
Part size when downloading files is now 4096 bytes, not 1024
2017-08-24 13:15:33 +02:00
Lonami Exo
09272ef6fc
Support connecting and downloading encrypted files from CDNs ( #208 )
2017-08-24 13:02:48 +02:00
Lonami Exo
571d8bc21f
Update to v0.12
2017-08-23 01:47:52 +02:00
Lonami Exo
65d5ab685f
Let .upload_file() support streams and byte arrays
2017-08-23 01:43:08 +02:00
Lonami Exo
4234efcc86
Make sending files a lot more friendly with a simple .send_file()
2017-08-23 00:27:33 +02:00
Lonami Exo
fb5c43b539
Ensure .connect() always returns True/False
2017-08-22 23:17:05 +02:00
Lonami Exo
7844cd358e
Attempt at making layer migrations more smooth ( #158 )
2017-07-26 16:10:45 +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
Lonami Exo
3be995b5a3
Update to v0.11.5
2017-07-11 11:38:17 +02:00
Lonami Exo
5ded836437
Update to v0.11.4
2017-07-10 16:13:45 +02:00
Lonami Exo
1f7ac71187
Debug level should always be used for logging since it's a library
2017-07-10 15:21:20 +02:00