Skip to content

Commit

Permalink
Clean up some more twirks on RTD and update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Jan 5, 2018
1 parent 9635a57 commit a489b4b
Show file tree
Hide file tree
Showing 8 changed files with 313 additions and 211 deletions.
6 changes: 3 additions & 3 deletions readthedocs/extra/basic/creating-a-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
14 changes: 7 additions & 7 deletions readthedocs/extra/basic/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()``
Expand Down
3 changes: 1 addition & 2 deletions readthedocs/extra/basic/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`

1 change: 0 additions & 1 deletion readthedocs/extra/basic/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion readthedocs/extra/developing/api-status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ instance through ``curl``. A JSON response will be returned.
curl https://rpc.pwrtelegram.xyz/?for=messages.sendMessage
**Number of ``RPC_CALL_FAIL``\ 's**:
**Number of** ``RPC_CALL_FAIL``:

.. code:: bash
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/extra/troubleshooting/rpc-errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ RPC stands for Remote Procedure Call, and when Telethon raises an
methods incorrectly (wrong parameters, wrong permissions, or even
something went wrong on Telegram's server). The most common are:

- ``FloodError`` (420), the same request was repeated many times. Must
wait ``.seconds``.
- ``FloodWaitError`` (420), the same request was repeated many times.
Must wait ``.seconds`` (you can access this parameter).
- ``SessionPasswordNeededError``, if you have setup two-steps
verification on Telegram.
- ``CdnFileTamperedError``, if the media you were trying to download
Expand Down
5 changes: 5 additions & 0 deletions readthedocs/extra/wall-of-shame.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
=============
Wall of Shame
=============


This project has an
`issues <https://github.com/LonamiWebs/Telethon/issues>`__ section for
you to file **issues** whenever you encounter any when working with the
Expand Down

0 comments on commit a489b4b

Please sign in to comment.