Telethon

Latest version: v1.35.0

Safety actively analyzes 629599 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 7

0.13.5

Yet another update to fix some bugs and increase the stability of the library, or, at least, that was the attempt!

This release should really **improve the experience with the background thread** that the library starts to read things from the network as soon as it can, but I can't spot every use case, so please report any bug (and as always, minimal reproducible use cases will help a lot).

Bug fixes
* `setup.py` was failing on Python < 3.5 due to some imports.
* Duplicated updates should now be ignored.
* `.send_message` would crash in some cases, due to having a typo using the wrong object.
* `"socket is None"` when calling `.connect()` should not happen anymore.
* `BrokenPipeError` was still being raised due to an incorrect order on the `try/except` block.

Enhancements
* **Type hinting** for all the generated `Request`'s and `TLObjects`! IDEs like PyCharm will benefit from this.
* `ProxyConnectionError` should properly be passed to the main thread for you to handle.
* The background thread will only be started after you're authorized on Telegram (i.e. logged in), and several other attempts at polishing the experience with this thread.
* The `Connection` instance is only created once now, and reused later.
* Calling `.connect()` should have a better behavior now (like actually *trying* to connect even if we seemingly were connected already).
* `.reconnect()` behavior has been changed to also be more consistent by making the assumption that we'll only reconnect if the server has disconnected us, and is now private.

Other changes
* `TLObject.__repr__` doesn't show the original TL definition anymore, it was a lot of clutter. If you have any complaints open an issue and we can discuss it.
* Internally, the `'+'` from the phone number is now stripped, since it shouldn't be included.
* Spotted a new place where `BrokenAuthKeyError` would be raised, and it now is raised there.

0.13.4

New stuff:
* `TelegramClient` now exposes a `.is_connected()` method.
* Initial authorization on a new data center will retry up to 5 times by default.
* Errors that couldn't be handled on the background thread will be raised on the next call to `.invoke()` or `updates.poll()`.

Bugs fixed:
* Now you should be able to sign in even if you have `process_updates=True` and no previous session.
* Some errors and methods are documented a bit clearer.
* `.send_message()` could randomly fail, as the returned type was not expected.

Things that should reduce the amount of crashes:
* `TimeoutError` is now ignored, since the request will be retried up to 5 times by default.
* "-404" errors (`BrokenAuthKeyError`'s) are now detected when first connecting to a new data center.
* `BufferError` is handled more gracefully, in the same way as `InvalidCheckSumError`'s.
* Attempt at fixing some "NoneType has no attribute…" errors (with the `.sender`).

Other internal changes:
* Calling `GetConfigRequest` is now made less often.
* The `initial_query` parameter from `.connect()` is gone, as it's not needed anymore.
* Renamed `all_tlobjects.layer` to `all_tlobjects.LAYER` (since it's a constant).
* The message from `BufferError` is now more useful.

0.13.3

Bugs fixed
* **Reconnection** used to fail because it tried invoking things from the `ReadThread`.
* Inferring **random ids** for `ForwardMessagesRequest` wasn't working.
* Downloading media from **CDNs** failed due to having forgotten to remove a single line.
* `TcpClient.close()` now has a **`threading.Lock`**, so `NoneType has no close()` should not happen.
* New **workaround** for `msg seqno too low/high`. Also, both `Session.id/seq` are not saved anymore.

Enhancements
* **Request will be retried** up to 5 times by default rather than failing on the first attempt.
* `InvalidChecksumError`'s are now **ignored** by the library.
* `TelegramClient.get_entity()` is now **public**, and uses the `lru_cache()` decorator.
* New method to **`.send_voice_note()`**'s.
* Methods to send message and media now support a **`reply_to` parameter**.
* `.send_message()` now returns the **full message** which was just sent.

0.13.2

This update brings a new way to work with updates, and it's begging for your **feedback**, or better names or ways to do what you can do now.

Please refer to the [wiki/Usage Modes](https://github.com/LonamiWebs/Telethon/wiki/Usage-Modes) for an in-depth description on how to work with updates now. Notice that you cannot invoke requests from within handlers anymore, only the `v.0.13.1` patch allowed you to do so.

**Other fixes**:
* Periodic pings are back.
* The username regex mentioned on `UsernameInvalidError` was invalid, but it has now been fixed.
* Sending a message to a phone number was failing because the type used for a request had changed on layer 71.
* CDN downloads weren't working properly, and now a few patches have been applied to ensure more reliability, although I couldn't personally test this, so again, report any feedback.

0.13.1

**Please read**, unless you don't handle updates in any way.

A silly "bug" which hadn't been spotted has now been fixed. Now you can invoke other requests from within your update callbacks. However **this is not advised**. You should post these updates to some other thread, and let that thread do the job instead. Invoking a request from within a callback will mean that, while this request is being invoked, no other things will be read.

Internally, the generated code now resides under a *lot* less files, simply for the sake of avoiding so many unnecessary files. The generated code is not meant to be read by anyone, simply to do its job.

Unused attributes have been removed from the `TLObject` class too, and `.sign_up()` returns the user that just logged in in a similar way to `.sign_in()` now.

0.13

<table><tr><td>Scheme layer used: <code>71</code></td></tr></table>

The purpose of this release is to denote a big change, now you can connect to Telegram through different [**connection modes**](https://github.com/LonamiWebs/Telethon/blob/v0.13/telethon/network/connection.py). Also, a **second thread** will *always* be started when you connect a `TelegramClient`, despite whether you'll be handling updates or ignoring them, whose sole purpose is to constantly read from the network.

The reason for this change is as simple as *"reading and writing shouldn't be related"*. Even when you're simply ignoring updates, this way, once you send a request you will only need to read the result for the request. Whatever Telegram sent before has already been read and outside the buffer.

Additions
* The mentioned different connection modes, and a new thread.
* You can modify the `Session` attributes through the `TelegramClient` constructor (using `**kwargs`).
* `RPCError`'s now belong to some request you've made, which makes more sense.
* `get_input_*` now handles `None` (default) parameters more gracefully (it used to crash).

Enhancements
* The low-level socket doesn't use a handcrafted timeout anymore, which should benefit by avoiding the arbitrary `sleep(0.1)` that there used to be.
* `TelegramClient.sign_in` will call `.send_code_request` if no `code` was provided.

Deprecation:
* `.sign_up` does *not* take a `phone` argument anymore. Change this or you will be using `phone` as `code`, and it will fail! The definition looks like `def sign_up(self, code, first_name, last_name='')`.
* The old `JsonSession` finally replaces the original `Session` (which used pickle). If you were overriding any of these, you should only worry about overriding `Session` now.

Page 3 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.