Commit Graph

3013 Commits

Author SHA1 Message Date
Lonami Exo
6f690945f1 Add a few security checks when unpacking messages from server
Also delete MtProto 1.0 leftovers.
2018-01-06 02:03:23 +01:00
Lonami Exo
3eafe18d0b Implement MtProto 2.0 (closes #484, thanks @delivrance!)
Huge shoutout to @delivrance's pyrogram, specially this commit:
pyrogram/pyrogram/commit/42f9a2d6994baaf9ecad590d1ff4d175a8c56454
2018-01-06 01:55:11 +01:00
Lonami Exo
c039ba3e16 Be consistent with the titles in the changelog 2018-01-05 23:48:21 +01:00
Lonami Exo
60594920bd Add changelog from GitHub releases to RTD 2018-01-05 23:19:58 +01:00
Lonami Exo
4871a6fb96 Accept 'me' and 'self' usernames to get self user entity 2018-01-05 19:51:44 +01:00
Lonami Exo
ec4ca5dbfc More consistent with asyncio branch (style/small fixes)
Like passing an extra (invalid) dt parameter when serializing
a datetime, and handling more errors in the TcpClient class.
2018-01-05 18:31:48 +01:00
Lonami Exo
c4e26c95f5 Always cache files smaller than 10MB, now in the database
This removes the need for a .clear_cache() method as now files
are identified by their MD5 (which needs to be calculated
always) and their file size (to make collisions even more
unlikely) instead using the file path (which can now change).
2018-01-05 15:33:25 +01:00
Lonami Exo
a489b4b18b Clean up some more twirks on RTD and update docstrings 2018-01-05 13:30:21 +01:00
Lonami Exo
9635a57683 Update README to point to RTD instead GitHub's wiki 2018-01-05 01:03:57 +01:00
Lonami Exo
cb45e8fca9 Clean up and complete RTD documentation 2018-01-05 00:59:53 +01:00
Lonami Exo
6cb5931e7a Call .disconnect() on client.__del__ for convenience 2018-01-04 23:37:47 +01:00
Lonami Exo
b45b63d71d Assert ._first_request is True with None auth_key (#517) 2018-01-04 21:07:29 +01:00
Lonami Exo
4fba27dee9 Accept InputFile/InputFileBig on .upload_file for 2c437c51
Now an input file thumbnail can also be specified, instead
needing to reupload the file every time.
2018-01-04 15:33:48 +01:00
Lonami
32505b905f
Merge pull request #519 from csabahenk/master
* Fix interactive example (get dialogs)
* Return message in send_file
* Support thumbnail for send_file
2018-01-04 15:30:42 +01:00
Csaba Henk
2c437c51bb client: add thumbnail support for send_file() 2018-01-04 12:17:47 +01:00
Csaba Henk
78871b697e client: return the message in send_file, too 2018-01-04 12:17:47 +01:00
Csaba Henk
b9cd9a6639 fix get_dialogs() return type in example
Catching up with 238198db where get_dialogs
return type was changed.
2018-01-04 12:03:29 +01:00
Lonami Exo
33d6afa0bd Add missing L74 hash parameter to .get_message_history() 2018-01-03 19:18:24 +01:00
Lonami Exo
6eef6f5d23 Update to layer 74 2018-01-02 00:02:31 +01:00
Lonami Exo
cbf6306599 Fix early cast to input from 932ed9e causing error on Peer 2017-12-29 22:07:16 +01:00
Lonami Exo
d2121c76cb Fetch and persist each auth_key per DC 2017-12-29 19:41:12 +01:00
Lonami Exo
0570c55120 Remove hardcoded database version from session sql statement 2017-12-29 00:43:52 +01:00
Lonami Exo
47b53ce89f Except only UnicodeDecodeError to check migration (fix #511) 2017-12-28 17:06:14 +01:00
Lonami Exo
ea436a4fac Update README.rst 2017-12-28 16:25:41 +01:00
Lonami Exo
4a139b0ae4 Fix session table may be empty if no DC switch 2017-12-28 14:58:42 +01:00
Lonami Exo
50d413b1c9 Fix slicing dialogs was turning UserList into list 2017-12-28 14:55:02 +01:00
Lonami Exo
55b67b65a1 Remove optional add_mark parameter from .get_peer_id
It was always True after all, and it made no sense for it to
be False.
2017-12-28 13:31:43 +01:00
Lonami Exo
7ed3be8e6f Fix .get_dialogs() failing due to IDs being marked
Also removed utils.find_user_or_chat to prevent this from
happening again. Using a dict {marked_id: entity} is better.
2017-12-28 13:21:35 +01:00
Lonami Exo
c23c0a557a Update to v0.16 2017-12-28 12:43:50 +01:00
Lonami Exo
3537e9bcc9 Support more types to represent a date 2017-12-28 12:32:16 +01:00
Lonami Exo
75a342e24b Fix .download_media() not handling Photo (closes #473) 2017-12-28 12:11:31 +01:00
Lonami Exo
bfff1567af Fix up some mismatching raise/except types since 6ec6967 2017-12-28 11:55:05 +01:00
Lonami Exo
459022bdab Return a UserList with a .total attribute for get dialogs/history 2017-12-28 11:49:35 +01:00
Lonami Exo
0755bda220 Stop returning tuples off .get_message_history()
Now the information is saved in the modified Message instances,
which makes it easier to use (message.sender, message.to...)
2017-12-28 02:01:22 +01:00
Lonami Exo
52a4ef82f4 Merge branch 'master' of github.com:LonamiWebs/Telethon 2017-12-28 01:17:30 +01:00
Lonami Exo
b35fc075e0 Merge branch 'sqlite-session' 2017-12-28 01:15:12 +01:00
Lonami Exo
2a10f31511 Always wrap init connection for first call
Ping @delivrance.
See https://core.telegram.org/api/invoking#saving-client-info.
2017-12-28 01:13:24 +01:00
Lonami Exo
ab07f0220a Save dc_id instead layer and salt in the session file
Server salts change every 30 minutes after all, so keeping them
in the long-term storage session file doesn't make much sense.

Saving the layer doesn't make sense either, as it was only used
to know whether to init connection or not, but it should be done
always.
2017-12-28 01:06:27 +01:00
Dmitry D. Chernov
6ec6967ff9 Make exception types correspond to Python docs 2017-12-28 09:48:02 +10:00
Lonami Exo
1a746e1464 Fix .download_profile_photo() for some channels (closes #500) 2017-12-28 09:48:02 +10:00
Lonami Exo
166d5a4012 Fix .get_dialogs() being inconsistent with the return type 2017-12-28 09:48:01 +10:00
Dmitry D. Chernov
b252468ca2 TelegramBareClient: Add set_proxy() method
This allows to change proxy without recreation of the client instance.
2017-12-28 09:48:01 +10:00
Lonami Exo
b1b3610c1f Add missing self to .set_proxy (fa64a5f) 2017-12-28 00:09:29 +01:00
Lonami Exo
bdd63b91a2 Fix .download_profile_photo() for some channels (closes #500) 2017-12-27 23:54:31 +01:00
Lonami Exo
292e4fc29f Fix .get_dialogs() being inconsistent with the return type 2017-12-27 23:46:06 +01:00
Dmitry D. Chernov
fa64a5f7b8 TelegramBareClient: Add set_proxy() method
This allows to change proxy without recreation of the client instance.
2017-12-28 07:50:49 +10:00
Dmitry D. Chernov
a5b1457eee TelegramBareClient: Fix lost #region 2017-12-28 07:33:25 +10:00
Lonami Exo
f3d47769df Fix .send_read_acknowledge() for channels (#501) 2017-12-27 15:26:23 +01:00
Lonami Exo
21e5f0b547 Fix GetUsersRequest has a limit of 200 2017-12-27 15:08:29 +01:00
Birger Jarl
73edb0f4ff Avoid using None dates on file download (#462) 2017-12-27 14:52:33 +01:00