mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Clean up some more twirks on RTD and update docstrings
This commit is contained in:
@@ -98,7 +98,7 @@ Two Factor Authorization (2FA)
|
||||
|
||||
If you have Two Factor Authorization (from now on, 2FA) enabled on your
|
||||
account, calling :meth:`telethon.TelegramClient.sign_in` will raise a
|
||||
`SessionPasswordNeededError`. When this happens, just
|
||||
``SessionPasswordNeededError``. When this happens, just
|
||||
:meth:`telethon.TelegramClient.sign_in` again with a ``password=``:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -113,7 +113,7 @@ account, calling :meth:`telethon.TelegramClient.sign_in` will raise a
|
||||
client.sign_in(password=getpass.getpass())
|
||||
|
||||
|
||||
If you don't have 2FA enabled, but you would like to do so through Telethon,
|
||||
If you don't have 2FA enabled, but you would like to do so through the library,
|
||||
take as example the following code snippet:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -146,4 +146,4 @@ for the tip!
|
||||
|
||||
|
||||
__ https://github.com/Anorov/PySocks#installation
|
||||
__ https://github.com/Anorov/PySocks#usage-1%3E
|
||||
__ https://github.com/Anorov/PySocks#usage-1
|
||||
|
@@ -34,22 +34,22 @@ you're able to just do this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# dialogs are the "conversations you have open"
|
||||
# this method returns a list of Dialog, which
|
||||
# have the .entity attribute and other information.
|
||||
# Dialogs are the "conversations you have open".
|
||||
# This method returns a list of Dialog, which
|
||||
# has the .entity attribute and other information.
|
||||
dialogs = client.get_dialogs(limit=200)
|
||||
|
||||
# all of these work and do the same
|
||||
# All of these work and do the same.
|
||||
lonami = client.get_entity('lonami')
|
||||
lonami = client.get_entity('t.me/lonami')
|
||||
lonami = client.get_entity('https://telegram.dog/lonami')
|
||||
|
||||
# other kind of entities
|
||||
# Other kind of entities.
|
||||
channel = client.get_entity('telegram.me/joinchat/AAAAAEkk2WdoDrB4-Q8-gg')
|
||||
contact = client.get_entity('+34xxxxxxxxx')
|
||||
friend = client.get_entity(friend_id)
|
||||
|
||||
# using peers/input peers (note that the API may return these)
|
||||
# Using Peer/InputPeer (note that the API may return these)
|
||||
# users, chats and channels may all have the same ID, so it's
|
||||
# necessary to wrap (at least) chat and channels inside Peer.
|
||||
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
|
||||
@@ -79,7 +79,7 @@ possible, making zero API calls most of the time. When a request is made,
|
||||
if you provided the full entity, e.g. an ``User``, the library will convert
|
||||
it to the required ``InputPeer`` automatically for you.
|
||||
|
||||
**You should always favour ``.get_input_entity()``** over ``.get_entity()``
|
||||
**You should always favour** ``.get_input_entity()`` **over** ``.get_entity()``
|
||||
for this reason! Calling the latter will always make an API call to get
|
||||
the most recent information about said entity, but invoking requests don't
|
||||
need this information, just the ``InputPeer``. Only use ``.get_entity()``
|
||||
|
@@ -50,8 +50,7 @@ Basic Usage
|
||||
client.send_file('username', '/home/myself/Pictures/holidays.jpg')
|
||||
|
||||
client.download_profile_photo(me)
|
||||
total, messages, senders = client.get_message_history('username')
|
||||
messages = client.get_message_history('username')
|
||||
client.download_media(messages[0])
|
||||
|
||||
**More details**: :ref:`telegram-client`
|
||||
|
||||
|
@@ -65,4 +65,3 @@ __ https://github.com/ricmoo/pyaes
|
||||
__ https://pypi.python.org/pypi/pyaes
|
||||
__ https://github.com/sybrenstuvel/python-rsa/
|
||||
__ https://pypi.python.org/pypi/rsa/3.4.2
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/199
|
||||
|
Reference in New Issue
Block a user