Clean-up docs and merge some imports

This commit is contained in:
Lonami Exo 2018-05-30 18:55:01 +02:00
parent 780c66c619
commit ae87d452c8
7 changed files with 32 additions and 23 deletions

View File

@ -11,10 +11,10 @@ Accessing the Full API
reason not to, like a method not existing or you wanting more control. reason not to, like a method not existing or you wanting more control.
The ``TelegramClient`` doesn't offer a method for every single request The `telethon.telegram_client.TelegramClient` doesn't offer a method for every
the Telegram API supports. However, it's very simple to *call* or *invoke* single request the Telegram API supports. However, it's very simple to *call*
any request. Whenever you need something, don't forget to `check the or *invoke* any request. Whenever you need something, don't forget to `check
documentation`__ and look for the `method you need`__. There you can go the documentation`__ and look for the `method you need`__. There you can go
through a sorted list of everything you can do. through a sorted list of everything you can do.
@ -30,9 +30,9 @@ You should also refer to the documentation to see what the objects
(constructors) Telegram returns look like. Every constructor inherits (constructors) Telegram returns look like. Every constructor inherits
from a common type, and that's the reason for this distinction. from a common type, and that's the reason for this distinction.
Say ``client.send_message()`` didn't exist, we could use the `search`__ Say `telethon.telegram_client.TelegramClient.send_message` didn't exist,
to look for "message". There we would find :tl:`SendMessageRequest`, we could use the `search`__ to look for "message". There we would find
which we can work with. :tl:`SendMessageRequest`, which we can work with.
Every request is a Python class, and has the parameters needed for you Every request is a Python class, and has the parameters needed for you
to invoke it. You can also call ``help(request)`` for information on to invoke it. You can also call ``help(request)`` for information on
@ -63,7 +63,7 @@ construct one, for instance:
peer = InputPeerUser(user_id, user_hash) peer = InputPeerUser(user_id, user_hash)
Or we call ``.get_input_entity()``: Or we call `telethon.telegram_client.TelegramClient.get_input_entity()`:
.. code-block:: python .. code-block:: python
@ -74,7 +74,7 @@ When you're going to invoke an API method, most require you to pass an
``.get_input_entity()`` is more straightforward (and often ``.get_input_entity()`` is more straightforward (and often
immediate, if you've seen the user before, know their ID, etc.). immediate, if you've seen the user before, know their ID, etc.).
If you also need to have information about the whole user, use If you also need to have information about the whole user, use
``.get_entity()`` instead: `telethon.telegram_client.TelegramClient.get_entity()` instead:
.. code-block:: python .. code-block:: python
@ -83,7 +83,7 @@ If you also need to have information about the whole user, use
In the later case, when you use the entity, the library will cast it to In the later case, when you use the entity, the library will cast it to
its "input" version for you. If you already have the complete user and its "input" version for you. If you already have the complete user and
want to cache its input version so the library doesn't have to do this want to cache its input version so the library doesn't have to do this
every time its used, simply call ``.get_input_peer``: every time its used, simply call `telethon.utils.get_input_peer`:
.. code-block:: python .. code-block:: python

View File

@ -7,7 +7,7 @@ Session Files
The first parameter you pass to the constructor of the ``TelegramClient`` is The first parameter you pass to the constructor of the ``TelegramClient`` is
the ``session``, and defaults to be the session name (or full path). That is, the ``session``, and defaults to be the session name (or full path). That is,
if you create a ``TelegramClient('anon')`` instance and connect, an if you create a ``TelegramClient('anon')`` instance and connect, an
``anon.session`` file will be created on the working directory. ``anon.session`` file will be created in the working directory.
Note that if you pass a string it will be a file in the current working Note that if you pass a string it will be a file in the current working
directory, although you can also pass absolute paths. directory, although you can also pass absolute paths.

View File

@ -44,7 +44,7 @@ That's it! This is the old way to listen for raw updates, with no further
processing. If this feels annoying for you, remember that you can always processing. If this feels annoying for you, remember that you can always
use :ref:`working-with-updates` but maybe use this for some other cases. use :ref:`working-with-updates` but maybe use this for some other cases.
Now let's do something more interesting. Every time an user talks to use, Now let's do something more interesting. Every time an user talks to us,
let's reply to them with the same text reversed: let's reply to them with the same text reversed:
.. code-block:: python .. code-block:: python

View File

@ -58,8 +58,7 @@ Manual Installation
5. Done! 5. Done!
To generate the `method documentation`__, ``cd docs`` and then To generate the `method documentation`__, ``python3 setup.py gen docs``.
``python3 generate.py`` (if some pages render bad do it twice).
Optional dependencies Optional dependencies

View File

@ -2,14 +2,15 @@
Deleted, Limited or Deactivated Accounts Deleted, Limited or Deactivated Accounts
======================================== ========================================
If you're from Iran or Russian, we have bad news for you. If you're from Iran or Russia, we have bad news for you. Telegram is much more
Telegram is much more likely to ban these numbers, likely to ban these numbers, as they are often used to spam other accounts,
as they are often used to spam other accounts, likely through the use of libraries like this one. The best advice we can
likely through the use of libraries like this one. give you is to not abuse the API, like calling many requests really quickly,
The best advice we can give you is to not abuse the API,
like calling many requests really quickly,
and to sign up with these phones through an official application. and to sign up with these phones through an official application.
We have also had reports from Kazakhstan and China, where connecting
would fail. To solve these connection problems, you should use a proxy.
Telegram may also ban virtual (VoIP) phone numbers, Telegram may also ban virtual (VoIP) phone numbers,
as again, they're likely to be used for spam. as again, they're likely to be used for spam.

View File

@ -11,8 +11,7 @@ from ..tl.types import (
ServerDHInnerData, ClientDHInnerData, DhGenOk, DhGenRetry, DhGenFail ServerDHInnerData, ClientDHInnerData, DhGenOk, DhGenRetry, DhGenFail
) )
from .. import helpers as utils from .. import helpers as utils
from ..crypto import AES, AuthKey, Factorization from ..crypto import AES, AuthKey, Factorization, rsa
from ..crypto import rsa
from ..errors import SecurityError from ..errors import SecurityError
from ..extensions import BinaryReader from ..extensions import BinaryReader
from ..network import MtProtoPlainSender from ..network import MtProtoPlainSender

View File

@ -40,6 +40,16 @@ body {
font-size: 16px; font-size: 16px;
} }
::-moz-selection {
color: #000;
background: #0a0;
}
::selection {
color: #000;
background: #0a0;
}
a { a {
color: #0a0; color: #0a0;
} }