mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 12:40:22 +03:00
Changes to documentation and "Number of retries reached 0."
This commit is contained in:
parent
4050d1ca00
commit
ad74926e33
|
@ -43,14 +43,15 @@ you're able to just do this:
|
||||||
my_channel = client.get_entity(PeerChannel(some_id))
|
my_channel = client.get_entity(PeerChannel(some_id))
|
||||||
|
|
||||||
|
|
||||||
All methods in the :ref:`telegram-client` call ``.get_input_entity()`` to
|
All methods in the :ref:`telegram-client` call ``.get_input_entity()`` prior
|
||||||
further save you from the hassle of doing so manually, so doing things like
|
to sending the requst to save you from the hassle of doing so manually.
|
||||||
``client.send_message('lonami', 'hi!')`` is possible.
|
That way, convenience calls such as ``client.send_message('lonami', 'hi!')``
|
||||||
|
become possible.
|
||||||
|
|
||||||
Every entity the library "sees" (in any response to any call) will by
|
Every entity the library encounters (in any response to any call) will by
|
||||||
default be cached in the ``.session`` file, to avoid performing
|
default be cached in the ``.session`` file (an SQLite database), to avoid
|
||||||
unnecessary API calls. If the entity cannot be found, some calls
|
performing unnecessary API calls. If the entity cannot be found, additonal
|
||||||
like ``ResolveUsernameRequest`` or ``GetContactsRequest`` may be
|
calls like ``ResolveUsernameRequest`` or ``GetContactsRequest`` may be
|
||||||
made to obtain the required information.
|
made to obtain the required information.
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,16 +62,18 @@ Entities vs. Input Entities
|
||||||
|
|
||||||
Don't worry if you don't understand this section, just remember some
|
Don't worry if you don't understand this section, just remember some
|
||||||
of the details listed here are important. When you're calling a method,
|
of the details listed here are important. When you're calling a method,
|
||||||
don't call ``.get_entity()`` before, just use the username or phone,
|
don't call ``.get_entity()`` beforehand, just use the username or phone,
|
||||||
or the entity retrieved by other means like ``.get_dialogs()``.
|
or the entity retrieved by other means like ``.get_dialogs()``.
|
||||||
|
|
||||||
|
|
||||||
To save bandwidth, the API also makes use of their "input" versions.
|
On top of the normal types, the API also make use of what they call their
|
||||||
|
``Input*`` versions of objects.
|
||||||
The input version of an entity (e.g. ``InputPeerUser``, ``InputChat``,
|
The input version of an entity (e.g. ``InputPeerUser``, ``InputChat``,
|
||||||
etc.) only contains the minimum required information that's required
|
etc.) only contains the minimum information that's required from Telegram
|
||||||
for Telegram to be able to identify who you're referring to: their ID
|
to be able to identify who you're referring to:
|
||||||
and hash. This ID/hash pair is unique per user, so if you use the pair
|
a Peer's **ID** and **hash**.
|
||||||
given by another user **or bot** it will **not** work.
|
This ID/hash pair is unique per user, so if you use the pair given by another
|
||||||
|
user **or bot** it will **not** work.
|
||||||
|
|
||||||
To save *even more* bandwidth, the API also makes use of the ``Peer``
|
To save *even more* bandwidth, the API also makes use of the ``Peer``
|
||||||
versions, which just have an ID. This serves to identify them, but
|
versions, which just have an ID. This serves to identify them, but
|
||||||
|
|
|
@ -455,7 +455,9 @@ class TelegramBareClient:
|
||||||
with self._reconnect_lock:
|
with self._reconnect_lock:
|
||||||
self._reconnect()
|
self._reconnect()
|
||||||
|
|
||||||
raise RuntimeError('Number of retries reached 0.')
|
raise RuntimeError('Giving up on {} after {} failed attemps.'.format(
|
||||||
|
[type(x).__name__ for x in requests], retries
|
||||||
|
))
|
||||||
|
|
||||||
# Let people use client.invoke(SomeRequest()) instead client(...)
|
# Let people use client.invoke(SomeRequest()) instead client(...)
|
||||||
invoke = __call__
|
invoke = __call__
|
||||||
|
|
Loading…
Reference in New Issue
Block a user