Skip to content

Commit ffa0da5

Browse files
committed
Merge branch 'develop' into layer-95
# Conflicts: # pyrogram/__init__.py
2 parents 249e405 + f84f9ec commit ffa0da5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3441
-280
lines changed

README.rst

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,24 @@ Pyrogram
1717
1818
app.run()
1919
20-
**Pyrogram** is a brand new Telegram_ Client Library written from the ground up in Python and C. It can be used for
21-
building custom Telegram applications that interact with the MTProto API as both User and Bot.
20+
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and C.
21+
It enables you to easily create custom apps using both user and bot identities (bot API alternative) via the `MTProto API`_.
22+
23+
`Pyrogram in fully-asynchronous mode is also available » <https://github.com/pyrogram/pyrogram/issues/181>`_
24+
25+
`Working PoC of Telegram voice calls using Pyrogram » <https://github.com/bakatrouble/pytgvoip>`_
2226

2327
Features
2428
--------
2529

26-
- **Easy to use**: You can easily install Pyrogram using pip and start building your app right away.
27-
- **High-level**: The low-level details of MTProto are abstracted and automatically handled.
30+
- **Easy**: You can install Pyrogram with pip and start building your applications right away.
31+
- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way.
2832
- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C.
29-
- **Updated** to the latest Telegram API version, currently Layer 91 on top of MTProto 2.0.
30-
- **Documented**: The Pyrogram API is well documented and resembles the Telegram Bot API.
31-
- **Full API**, allowing to execute any advanced action an official client is able to do, and more.
33+
- **Documented**: Pyrogram API methods, types and public interfaces are well documented.
34+
- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted.
35+
- **Updated**, to the latest Telegram API version, currently Layer 91 on top of `MTProto 2.0`_.
36+
- **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code.
37+
- **Comprehensive**: Execute any advanced action an official client is able to do, and even more.
3238

3339
Requirements
3440
------------
@@ -43,11 +49,11 @@ Installing
4349
4450
pip3 install pyrogram
4551
46-
Getting Started
47-
---------------
52+
Resources
53+
---------
4854

4955
- The Docs contain lots of resources to help you getting started with Pyrogram: https://docs.pyrogram.ml.
50-
- Reading Examples_ in this repository is also a good way for learning how things work.
56+
- Reading `Examples in this repository`_ is also a good way for learning how Pyrogram works.
5157
- Seeking extra help? Don't be shy, come join and ask our Community_!
5258
- For other requests you can send an Email_ or a Message_.
5359

@@ -65,13 +71,15 @@ Copyright & License
6571
- Licensed under the terms of the `GNU Lesser General Public License v3 or later (LGPLv3+)`_
6672

6773
.. _`Telegram`: https://telegram.org/
74+
.. _`MTProto API`: https://core.telegram.org/api#telegram-api
6875
.. _`Telegram API key`: https://docs.pyrogram.ml/start/ProjectSetup#api-keys
6976
.. _`Community`: https://t.me/PyrogramChat
70-
.. _`Examples`: https://github.com/pyrogram/pyrogram/tree/master/examples
77+
.. _`Examples in this repository`: https://github.com/pyrogram/pyrogram/tree/master/examples
7178
.. _`GitHub`: https://github.com/pyrogram/pyrogram/issues
7279
.. _`Email`: admin@pyrogram.ml
7380
.. _`Message`: https://t.me/haskell
7481
.. _TgCrypto: https://github.com/pyrogram/tgcrypto
82+
.. _`MTProto 2.0`: https://core.telegram.org/mtproto
7583
.. _`GNU Lesser General Public License v3 or later (LGPLv3+)`: COPYING.lesser
7684

7785
.. |header| raw:: html
@@ -83,17 +91,17 @@ Copyright & License
8391
</h1>
8492

8593
<p align="center">
86-
<b>Telegram MTProto API Client Library for Python</b>
94+
<b>Telegram MTProto API Framework for Python</b>
8795

8896
<br>
89-
<a href="https://github.com/pyrogram/pyrogram/releases/latest">
90-
Download
91-
</a>
92-
9397
<a href="https://docs.pyrogram.ml">
9498
Documentation
9599
</a>
96100
101+
<a href="https://github.com/pyrogram/pyrogram/releases">
102+
Changelog
103+
</a>
104+
97105
<a href="https://t.me/PyrogramChat">
98106
Community
99107
</a>
@@ -104,20 +112,20 @@ Copyright & License
104112
</a>
105113
<a href="https://github.com/pyrogram/tgcrypto">
106114
<img src="https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30"
107-
alt="TgCrypto">
115+
alt="TgCrypto Version">
108116
</a>
109117
</p>
110118

111119
.. |logo| image:: https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png
112120
:target: https://pyrogram.ml
113121
:alt: Pyrogram
114122

115-
.. |description| replace:: **Telegram MTProto API Client Library for Python**
123+
.. |description| replace:: **Telegram MTProto API Framework for Python**
116124

117-
.. |scheme| image:: "https://img.shields.io/badge/schema-layer%2091-eda738.svg?longCache=true&colorA=262b30"
125+
.. |schema| image:: https://img.shields.io/badge/schema-layer%2091-eda738.svg?longCache=true&colorA=262b30
118126
:target: compiler/api/source/main_api.tl
119-
:alt: Scheme Layer
127+
:alt: Schema Layer
120128

121-
.. |tgcrypto| image:: "https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30"
129+
.. |tgcrypto| image:: https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30
122130
:target: https://github.com/pyrogram/tgcrypto
123-
:alt: TgCrypto
131+
:alt: TgCrypto Version

compiler/error/source/400_BAD_REQUEST.tsv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,7 @@ MESSAGE_POLL_CLOSED You can't interact with a closed poll
8787
MEDIA_INVALID The media is invalid
8888
BOT_SCORE_NOT_MODIFIED The bot score was not modified
8989
USER_BOT_REQUIRED The method can be used by bots only
90+
IMAGE_PROCESS_FAILED The server failed to process your image
91+
USERNAME_NOT_MODIFIED The username was not modified
92+
CALL_ALREADY_ACCEPTED The call is already accepted
93+
CALL_ALREADY_DECLINED The call is already declined
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
id message
22
FLOOD_WAIT_X A wait of {x} seconds is required
3+
TAKEOUT_INIT_DELAY_X You have to confirm the data export request using one of your mobile devices or wait {x} seconds

docs/source/index.rst

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,28 @@ Welcome to Pyrogram
1010
</div>
1111

1212
<p align="center">
13-
<b>Telegram MTProto API Client Library for Python</b>
13+
<b>Telegram MTProto API Framework for Python</b>
14+
1415
<br>
15-
<a href="https://github.com/pyrogram/pyrogram/releases/latest">
16-
Download
16+
<a href="https://docs.pyrogram.ml">
17+
Documentation
1718
</a>
1819
19-
<a href="https://github.com/pyrogram/pyrogram">
20-
Source code
20+
<a href="https://github.com/pyrogram/pyrogram/releases">
21+
Changelog
2122
</a>
2223
2324
<a href="https://t.me/PyrogramChat">
2425
Community
2526
</a>
2627
<br>
27-
<a href="https://github.com/pyrogram/pyrogram/blob/master/compiler/api/source/main_api.tl">
28+
<a href="compiler/api/source/main_api.tl">
2829
<img src="https://img.shields.io/badge/schema-layer%2091-eda738.svg?longCache=true&colorA=262b30"
29-
alt="Scheme Layer">
30+
alt="Schema Layer">
3031
</a>
3132
<a href="https://github.com/pyrogram/tgcrypto">
3233
<img src="https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30"
33-
alt="TgCrypto">
34+
alt="TgCrypto Version">
3435
</a>
3536
</p>
3637

@@ -48,25 +49,27 @@ Welcome to Pyrogram
4849
4950
app.run()
5051
51-
Welcome to Pyrogram's Documentation! Here you can find resources for learning how to use the library.
52+
Welcome to Pyrogram's Documentation! Here you can find resources for learning how to use the framework.
5253
Contents are organized into self-contained topics and can be accessed from the sidebar, or by following them in order
5354
using the Next button at the end of each page. But first, here's a brief overview of what is this all about.
5455

5556
About
5657
-----
5758

58-
**Pyrogram** is a brand new Telegram_ Client Library written from the ground up in Python and C. It can be used for
59-
building custom Telegram applications that interact with the MTProto API as both User and Bot.
59+
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and C.
60+
It enables you to easily create custom apps using both user and bot identities (bot API alternative) via the `MTProto API`_.
6061

6162
Features
6263
--------
6364

64-
- **Easy to use**: You can easily install Pyrogram using pip and start building your app right away.
65-
- **High-level**: The low-level details of MTProto are abstracted and automatically handled.
65+
- **Easy**: You can install Pyrogram with pip and start building your applications right away.
66+
- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way.
6667
- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C.
67-
- **Updated** to the latest Telegram API version, currently Layer 91 on top of MTProto 2.0.
68-
- **Documented**: The Pyrogram API is well documented and resembles the Telegram Bot API.
69-
- **Full API**, allowing to execute any advanced action an official client is able to do, and more.
68+
- **Documented**: Pyrogram API methods, types and public interfaces are well documented.
69+
- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted.
70+
- **Updated**, to the latest Telegram API version, currently Layer 91 on top of `MTProto 2.0`_.
71+
- **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code.
72+
- **Comprehensive**: Execute any advanced action an official client is able to do, and even more.
7073

7174
To get started, press the Next button.
7275

@@ -85,6 +88,7 @@ To get started, press the Next button.
8588
resources/UpdateHandling
8689
resources/UsingFilters
8790
resources/MoreOnUpdates
91+
resources/ConfigurationFile
8892
resources/SmartPlugins
8993
resources/AutoAuthorization
9094
resources/CustomizeSessions
@@ -95,6 +99,7 @@ To get started, press the Next button.
9599
resources/ErrorHandling
96100
resources/TestServers
97101
resources/AdvancedUsage
102+
resources/VoiceCalls
98103
resources/Changelog
99104

100105
.. toctree::
@@ -111,4 +116,6 @@ To get started, press the Next button.
111116
types/index
112117

113118
.. _`Telegram`: https://telegram.org/
114-
.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto/
119+
.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto/
120+
.. _`MTProto API`: https://core.telegram.org/api#telegram-api
121+
.. _`MTProto 2.0`: https://core.telegram.org/mtproto
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
Configuration File
2+
==================
3+
4+
As already mentioned in previous sections, Pyrogram can also be configured by the use of an INI file.
5+
This page explains how this file is structured in Pyrogram, how to use it and why.
6+
7+
Introduction
8+
------------
9+
10+
The idea behind using a configuration file is to help keeping your code free of settings (private) information such as
11+
the API Key and Proxy without having you to even deal with how to load such settings. The configuration file, usually
12+
referred as ``config.ini`` file, is automatically loaded from the root of your working directory; all you need to do is
13+
fill in the necessary parts.
14+
15+
.. note::
16+
17+
The configuration file is optional, but recommended. If, for any reason, you prefer not to use it, there's always an
18+
alternative way to configure Pyrogram via Client's parameters. Doing so, you can have full control on how to store
19+
and load your settings (e.g.: from environment variables).
20+
21+
Settings specified via Client's parameter have higher priority and will override any setting stored in the
22+
configuration file.
23+
24+
25+
The config.ini File
26+
-------------------
27+
28+
By default, Pyrogram will look for a file named ``config.ini`` placed at the root of your working directory, that is,
29+
the same folder of your running script. You can change the name or location of your configuration file by specifying it
30+
in your Client's parameter *config_file*.
31+
32+
- Replace the default *config.ini* file with *my_configuration.ini*:
33+
34+
.. code-block:: python
35+
36+
from pyrogram import Client
37+
38+
app = Client("my_account", config_file="my_configuration.ini")
39+
40+
41+
Configuration Sections
42+
----------------------
43+
44+
These are all the sections Pyrogram uses in its configuration file:
45+
46+
Pyrogram
47+
^^^^^^^^
48+
49+
The ``[pyrogram]`` section contains your Telegram API credentials *api_id* and *api_hash*.
50+
51+
.. code-block:: ini
52+
53+
[pyrogram]
54+
api_id = 12345
55+
api_hash = 0123456789abcdef0123456789abcdef
56+
57+
`More info about API Key. <../start/Setup.html#configuration>`_
58+
59+
Proxy
60+
^^^^^
61+
62+
The ``[proxy]`` section contains settings about your SOCKS5 proxy.
63+
64+
.. code-block:: ini
65+
66+
[proxy]
67+
enabled = True
68+
hostname = 11.22.33.44
69+
port = 1080
70+
username = <your_username>
71+
password = <your_password>
72+
73+
`More info about SOCKS5 Proxy. <SOCKS5Proxy.html>`_
74+
75+
Plugins
76+
^^^^^^^
77+
78+
The ``[plugins]`` section contains settings about Smart Plugins.
79+
80+
.. code-block:: ini
81+
82+
[plugins]
83+
root = plugins
84+
include =
85+
module
86+
folder.module
87+
exclude =
88+
module fn2
89+
90+
`More info about Smart Plugins. <SmartPlugins.html>`_

0 commit comments

Comments
 (0)