Clean-up documentation and include telethon.client

This commit is contained in:
Lonami Exo 2018-06-19 21:24:26 +02:00
parent 4e9a84c3b5
commit 1b7e7320a4
13 changed files with 119 additions and 145 deletions

View File

@ -20,7 +20,8 @@
import re import re
import os import os
import sys import sys
sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath(os.curdir))
sys.path.insert(0, os.path.abspath(os.pardir))
root = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir)) root = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir))

View File

@ -7,7 +7,7 @@ Accessing the Full API
.. important:: .. important::
While you have access to this, you should always use the friendly While you have access to this, you should always use the friendly
methods listed on :ref:`telethon-package` unless you have a better methods listed on :ref:`telethon-client` unless you have a better
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.

View File

@ -65,7 +65,7 @@ Basic Usage
**More details**: :ref:`telegram-client` **More details**: :ref:`telegram-client`
See :ref:`telethon-package` for all available friendly methods. See :ref:`telethon-client` for all available friendly methods.
Handling Updates Handling Updates

View File

@ -10,9 +10,9 @@ Introduction
.. note:: .. note::
Make sure to use the friendly methods described in :ref:`telethon-package`! Make sure to use the friendly methods described in :ref:`telethon-client`!
This section is just an introduction to using the client, but all the This section is just an introduction to using the client, but all the
available methods are in the :ref:`telethon-package` reference, including available methods are in the :ref:`telethon-client` reference, including
detailed descriptions to what they do. detailed descriptions to what they do.
The ``TelegramClient`` is the central class of the library, the one The ``TelegramClient`` is the central class of the library, the one
@ -99,7 +99,7 @@ Please refer to :ref:`accessing-the-full-api` if these aren't enough,
and don't be afraid to read the source code of the InteractiveTelegramClient_ and don't be afraid to read the source code of the InteractiveTelegramClient_
or even the TelegramClient_ itself to learn how it works. or even the TelegramClient_ itself to learn how it works.
See the mentioned :ref:`telethon-package` to find the available methods. See the mentioned :ref:`telethon-client` to find the available methods.
.. _InteractiveTelegramClient: https://github.com/LonamiWebs/Telethon/blob/master/telethon_examples/interactive_telegram_client.py .. _InteractiveTelegramClient: https://github.com/LonamiWebs/Telethon/blob/master/telethon_examples/interactive_telegram_client.py
.. _TelegramClient: https://github.com/LonamiWebs/Telethon/blob/master/telethon/telegram_client.py .. _TelegramClient: https://github.com/LonamiWebs/Telethon/blob/master/telethon/telegram_client.py

View File

@ -16,9 +16,9 @@ when you upgrade!
.. important:: .. important::
If you're new here, you want to read :ref:`getting-started`. If you're If you're new here, you want to read :ref:`getting-started`. If you're
looking for the method reference, you should check :ref:`telethon-package`. looking for the method reference, you should check :ref:`telethon-client`.
The mentioned :ref:`telethon-package` is an important section and it The mentioned :ref:`telethon-client` is an important section and it
contains the friendly methods that **you should use** most of the time. contains the friendly methods that **you should use** most of the time.

View File

@ -0,0 +1,76 @@
.. _telethon-client:
telethon\.client package
========================
The `telethon.TelegramClient` aggregates several mixin classes to provide
all the common functionality in a nice, Pythonic interface. Each mixin has
its own methods, which you all can use.
**In short, to create a client you must run:**
.. code-block:: python
import asyncio
from telethon import TelegramClient
async def main():
client = await TelegramClient(name, api_id, api_hash).start()
# Now you can use all client methods listed below, like for example...
await client.send_message('me', 'Hello to myself!')
asyncio.get_event_loop().run_until_complete()
You **don't** need to import these `AuthMethods`, `MessageMethods`, etc.
Together they are the `telethon.TelegramClient` and you can access all of
their methods.
.. automodule:: telethon.client.auth
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.chats
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.dialogs
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.messageparse
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.messages
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.updates
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.uploads
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.users
:members:
:undoc-members:
:show-inheritance:
.. automodule:: telethon.client.telegrambaseclient
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,53 +0,0 @@
telethon\.crypto package
========================
telethon\.crypto\.aes module
----------------------------
.. automodule:: telethon.crypto.aes
:members:
:undoc-members:
:show-inheritance:
telethon\.crypto\.aes\_ctr module
---------------------------------
.. automodule:: telethon.crypto.aes_ctr
:members:
:undoc-members:
:show-inheritance:
telethon\.crypto\.auth\_key module
----------------------------------
.. automodule:: telethon.crypto.auth_key
:members:
:undoc-members:
:show-inheritance:
telethon\.crypto\.cdn\_decrypter module
---------------------------------------
.. automodule:: telethon.crypto.cdn_decrypter
:members:
:undoc-members:
:show-inheritance:
telethon\.crypto\.factorization module
--------------------------------------
.. automodule:: telethon.crypto.factorization
:members:
:undoc-members:
:show-inheritance:
telethon\.crypto\.rsa module
----------------------------
.. automodule:: telethon.crypto.rsa
:members:
:undoc-members:
:show-inheritance:

View File

@ -13,12 +13,10 @@ telethon\.errors\.common module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.errors\.rpc\_base\_errors module telethon\.errors\.rpcbaseerrors module
------------------------------------------ --------------------------------------
.. automodule:: telethon.errors.rpc_base_errors .. automodule:: telethon.errors.rpcbaseerrors
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:

View File

@ -58,4 +58,3 @@ so all the methods in it can be used from any event builder/event instance.
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:

View File

@ -2,10 +2,10 @@ telethon\.extensions package
============================ ============================
telethon\.extensions\.binary\_reader module telethon\.extensions\.binaryreader module
------------------------------------------- -----------------------------------------
.. automodule:: telethon.extensions.binary_reader .. automodule:: telethon.extensions.binaryreader
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
@ -18,12 +18,18 @@ telethon\.extensions\.markdown module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.extensions\.tcp\_client module telethon\.extensions\.html module
---------------------------------------- ---------------------------------
.. automodule:: telethon.extensions.tcp_client .. automodule:: telethon.extensions.html
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.extensions\.tcpclient module
--------------------------------------
.. automodule:: telethon.extensions.tcpclient
:members:
:undoc-members:
:show-inheritance:

View File

@ -2,14 +2,6 @@ telethon\.network package
========================= =========================
telethon\.network\.authenticator module
---------------------------------------
.. automodule:: telethon.network.authenticator
:members:
:undoc-members:
:show-inheritance:
telethon\.network\.connection module telethon\.network\.connection module
------------------------------------ ------------------------------------
@ -18,20 +10,26 @@ telethon\.network\.connection module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.network\.mtproto\_plain\_sender module telethon\.network\.mtprotoplainsender module
------------------------------------------------ ------------------------------------------------
.. automodule:: telethon.network.mtproto_plain_sender .. automodule:: telethon.network.mtprotoplainsender
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.network\.mtproto\_sender module telethon\.network\.mtprotosender module
----------------------------------------- -----------------------------------------
.. automodule:: telethon.network.mtproto_sender .. automodule:: telethon.network.mtprotosender
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.network\.authenticator module
---------------------------------------
.. automodule:: telethon.network.authenticator
:members:
:undoc-members:
:show-inheritance:

View File

@ -5,21 +5,18 @@ telethon package
================ ================
telethon\.telegram\_client module telethon\.client module
--------------------------------- -----------------------
.. automodule:: telethon.telegram_client .. toctree::
telethon.client
.. automodule:: telethon.client
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.telegram\_bare\_client module
---------------------------------------
.. automodule:: telethon.telegram_bare_client
:members:
:undoc-members:
:show-inheritance:
telethon\.utils module telethon\.utils module
---------------------- ----------------------
@ -29,13 +26,6 @@ telethon\.utils module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.helpers module
------------------------
.. automodule:: telethon.helpers
:members:
:undoc-members:
:show-inheritance:
telethon\.events package telethon\.events package
------------------------ ------------------------
@ -45,14 +35,6 @@ telethon\.events package
telethon.events telethon.events
telethon\.update\_state module
------------------------------
.. automodule:: telethon.update_state
:members:
:undoc-members:
:show-inheritance:
telethon\.sessions module telethon\.sessions module
------------------------- -------------------------
@ -61,13 +43,6 @@ telethon\.sessions module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
telethon\.cryto package
------------------------
.. toctree::
telethon.crypto
telethon\.errors package telethon\.errors package
------------------------ ------------------------
@ -97,7 +72,6 @@ telethon\.tl package
telethon.tl telethon.tl
Module contents Module contents
--------------- ---------------

View File

@ -1,5 +1,5 @@
telethon\.tl package telethon\.tl\.custom package
==================== ============================
.. toctree:: .. toctree::
@ -7,30 +7,6 @@ telethon\.tl package
telethon.tl.custom telethon.tl.custom
telethon\.tl\.gzip\_packed module
---------------------------------
.. automodule:: telethon.tl.gzip_packed
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.message\_container module
---------------------------------------
.. automodule:: telethon.tl.message_container
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.tl\_message module
--------------------------------
.. automodule:: telethon.tl.tl_message
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.tlobject module telethon\.tl\.tlobject module
----------------------------- -----------------------------
@ -38,4 +14,3 @@ telethon\.tl\.tlobject module
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance: