Commit Graph

67 Commits

Author SHA1 Message Date
Lonami Exo
7d21b40401 Revert "Make sessions async"
This reverts commit d2de0f3aca.
2022-08-30 12:32:21 +02:00
Tulir Asokan
d2de0f3aca Make sessions async
SQLiteSession is not updated, don't try to use it
2022-05-12 10:36:10 +02:00
Reinier Romero Mir
f9643bf737
Add missing async when downloading from URL (#3222) 2021-12-01 20:28:55 +01:00
Anonymous
7c5efee1de
Update to layer 129 and other additions/enhancements (#3074)
* Apply code corrections for the new layer types.
* Support not passing `user` to `get_permissions`.
* `download_profile_photo` now supports `MessageService`.
* `thumb` in send and edit message.
* Document new known errors.
2021-06-15 22:57:32 +02:00
Lonami
3d350c6087
Don't check if offset is divisible by limit if limit is None
Should fix #3058.
2021-05-16 22:27:29 +02:00
blank X
f6a0f5f979
Make offset divisible by limit (#3042) 2021-05-14 08:11:54 +02:00
Lonami Exo
73b9de2085 Correctly sort PhotoSizeProgressive thumb size 2021-02-13 22:47:34 +01:00
Lonami Exo
b0158b3f65 Fix download of PhotoSizeProgressive
Closes #1700.
2021-02-13 22:45:12 +01:00
Lonami Exo
65bf0e4c45 Add missing importç 2021-01-24 01:38:44 +01:00
Lonami Exo
fa99f6a1af Try to handle TimeoutError during file download 2021-01-24 01:36:10 +01:00
Lonami Exo
dd00829f1e Ignore PhotoPathSize thumbnail sizes
Closes #1655.
2020-12-19 19:42:07 +01:00
Lonami Exo
c864ef7e16 Refetch msg if fileref expires while downloading docs
Closes #1301.
2020-09-24 10:03:28 +02:00
Lonami Exo
e19aa44d5c Sort thumbs to ensure -1 is largest
Closes #1519.
2020-08-11 23:14:31 +02:00
Lonami Exo
0cefc73448 Support both str and VideoSize as thumb on download_media 2020-08-11 22:31:12 +02:00
Lonami Exo
ddeefff431 Add a warning when trying to connect to a different account
Closes #1172, and also fixed a typo.
2020-08-08 17:49:00 +02:00
Lonami Exo
e0c3143763 Update documentation with new errors and further clarifications 2020-06-22 13:21:45 +02:00
Lonami Exo
3e511484c7 Support pathlib.Path on download_file
Fixes #1379.
2020-06-06 21:07:22 +02:00
Lonami Exo
7ea4686d6c Handle FloodWaitError in client.download_media
Fixes #1426. Not entirely happy with the new indirection layer,
but the original __call__ method is already a mess anyway and
the additional cost of an extra call should be neglible compared
to the actual IO.
2020-04-28 20:49:57 +02:00
Lonami Exo
c37dc69592 Fix downloading thumb was using name inferred for video 2020-04-23 21:01:29 +02:00
painor
0e0052888f
Expose key and iv parameter in downloads/uploads (#1397) 2020-03-04 16:12:34 +01:00
Lonami Exo
1ec38aa5b2 Update and clarify some docs
cc #1388, #1396
2020-02-28 11:50:16 +01:00
Lonami Exo
bdb74ac235 Support async fd on download/upload (#1334) 2019-12-27 12:04:08 +01:00
Lonami Exo
fa736f81af Handle all entity types on isinstance checks
Only the uses of `isinstance` against `InputPeer*` types were
reviewed. Notably, `utils` is exempt on this because it needs
to deal with everything on a case-by-case basis.

Since the addition of `*FromMessage` peers, any manual `isinstance`
checks to determine the type were prone to breaking or being
forgotten to be updated, so a common `helpers._entity_type()`
method was made to share this logic.

Since the conversion to `Peer` would be too expensive, a simpler
check against the name is made, which should be fast and cheap.
2019-12-23 13:52:07 +01:00
Lonami Exo
a1aaa96120 Fix iter_download would not determine file_size alone 2019-10-31 19:38:49 +01:00
Lonami Exo
e1905d0d7a Avoid using telethon.sync in the examples 2019-08-13 23:33:39 +02:00
Lonami Exo
cbcbda5276 Minor documentation and type hint updates 2019-07-17 12:37:16 +02:00
Lonami Exo
944fb10733 Add missing return self on action/download ctx managers 2019-07-13 21:21:29 +02:00
st7105
c4c263a85b Use flush() only if it exists (#1227) 2019-07-09 11:40:05 +02:00
Lonami Exo
8e36bb4c4d Link Python keywords with Python's documentation 2019-07-06 12:11:00 +02:00
Lonami
0d9e639f4f
Support asynchronous progress_callback's 2019-07-04 15:34:51 +02:00
Lonami Exo
b6b4ea669d Remove messy subclassing in the TelegramClient
Since it was easy to cause MRO inconsistencies, and it's
not really needed now that self is type hinted as the client.
2019-06-24 17:48:46 +02:00
Lonami
9d6150da37
Fix downloading contacts to path (#1197) 2019-06-03 15:44:43 +02:00
Lonami Exo
cf152403ee Use iter_download on download_file 2019-05-21 16:40:11 +02:00
Lonami Exo
0b0f8f4285 Create a method to iterate downloads 2019-05-21 16:16:32 +02:00
Lonami Exo
7c1c040d50 Update docstrings to have consistent style 2019-05-20 11:57:11 +02:00
Lonami Exo
4ca3517e22 Fix some type hints 2019-05-11 20:12:57 +02:00
Lonami Exo
a7443612f6 Fix download of PhotoStrippedSize to bytes 2019-05-09 18:56:54 +02:00
Lonami Exo
0a3d6106f0 Completely overhaul the documentation 2019-05-09 12:50:09 +02:00
Lonami Exo
d92d989569 Quote type hints
Otherwise, sphinx completely butchers the documentation.
2019-05-08 17:16:09 +02:00
Lonami Exo
61613ab6ac Create a new page with a summary of the method reference 2019-05-06 11:38:26 +02:00
Lonami Exo
cd4b915522 Add type hints to all public methods in the client 2019-05-03 21:38:41 +02:00
Lonami Exo
1e17ef1c98 Apply several lints 2019-05-03 21:38:41 +02:00
YoilyL
b0e96b2821 Fix stripped image downloads (#1165) 2019-04-25 20:31:52 +02:00
Lonami Exo
9fc719cb24 Update download_media with a new way to save thumbs (#1164) 2019-04-24 12:38:03 +02:00
Lonami Exo
bb23bc0fd2 Finish update to layer 98 2019-04-22 19:05:25 +02:00
Lonami Exo
8868ce14e8 Update to layer 98 2019-04-22 16:51:05 +02:00
Lonami Exo
ff8349ff3f Prevent download_profile_photo from downloading arbitrary files
First of all, because it shouldn't be doing that. Second, it was
buggy and was passing the tuple returned by get_input_location to
download_file which doesn't accept tuples (instead it should be
passed the photo object so that download_file could return dc_id
and input file location itself).
2019-04-03 09:51:33 +02:00
Lonami
f95933c246
Fix downloading contacts (#1147) 2019-04-02 14:33:41 +02:00
Lonami Exo
04ba2e1fc7 Revert disconnect() to be async again (#1133)
It's the only way to properly clean all background tasks,
which the library makes heavy use for in MTProto/Connection
send and receive loops.

Some parts of the code even relied on the fact that it was
asynchronous (it used to return a future so you could await
it and not be breaking).

It's automatically syncified to reduce the damage of being
a breaking change.
2019-03-21 12:21:00 +01:00
Lonami Exo
bb5c1f24c6 Update to layer 93 2019-01-21 20:09:13 +01:00