2017-12-10 19:43:31 +00:00
|
|
|
|header|
|
|
|
|
|
|
|
|
Table of Contents
|
|
|
|
=================
|
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
- `About`_
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
- `Features`_
|
|
|
|
|
|
|
|
- `Requirements`_
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
- `Getting Started`_
|
2018-01-02 15:29:15 +00:00
|
|
|
|
|
|
|
- `Installation`_
|
|
|
|
|
2018-01-08 05:45:07 +00:00
|
|
|
- `Configuration`_
|
2018-01-02 15:29:15 +00:00
|
|
|
|
|
|
|
- `Usage`_
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2017-12-11 07:59:11 +00:00
|
|
|
- `Documentation`_
|
|
|
|
|
2017-12-10 19:43:31 +00:00
|
|
|
- `Contribution`_
|
|
|
|
|
|
|
|
- `Feedback`_
|
|
|
|
|
2017-12-17 13:22:03 +00:00
|
|
|
- `License`_
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
About
|
|
|
|
=====
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
**Pyrogram** is a fully functional Telegram Client Library written from the ground up in Python.
|
|
|
|
It offers simple and complete access to the `Telegram Messenger API`_ and is designed for Python
|
|
|
|
developers keen on building custom Telegram applications.
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
Features
|
|
|
|
--------
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
- **Easy to setup**: Pyrogram can be easily installed and upgraded using **pip**, requires
|
2018-01-01 20:47:12 +00:00
|
|
|
a minimal set of dependencies (which are also automatically managed) and very few lines
|
|
|
|
of code to get started with.
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
- **Easy to use**: Pyrogram provides idiomatic, developer-friendly, clean and readable
|
|
|
|
Python code (either generated or hand-written) making the Telegram API simple to use.
|
2018-02-17 14:35:49 +00:00
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
- **High level**: Pyrogram automatically handles all the low-level details of
|
|
|
|
communication with the Telegram servers by implementing the
|
|
|
|
`MTProto Mobile Protocol v2.0`_ and the mechanisms needed for establishing
|
|
|
|
a reliable connection.
|
2018-02-17 14:35:49 +00:00
|
|
|
|
|
|
|
- **Fast**: Pyrogram's speed is boosted up by `TgCrypto`_, a high-performance, easy-to-install
|
|
|
|
Telegram Crypto Library written in C as a Python extension.
|
|
|
|
|
2018-01-20 15:21:25 +00:00
|
|
|
- **Updated**: Pyrogram makes use of the latest Telegram API version, currently `Layer 75`_.
|
2018-02-17 14:35:49 +00:00
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
- **Documented**: Pyrogram API public methods are documented and resemble the well
|
|
|
|
established Telegram Bot API, thus offering a familiar look to Bot developers.
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-01 20:47:12 +00:00
|
|
|
- **Full API support**: Beside the simple, bot-like methods offered by the Pyrogram API,
|
|
|
|
the library also provides a complete, low-level access to every single Telegram API method.
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
Requirements
|
2018-01-01 20:47:12 +00:00
|
|
|
------------
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
- Python 3.3 or higher.
|
|
|
|
|
|
|
|
- A Telegram API key.
|
2018-01-02 15:29:15 +00:00
|
|
|
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-02 15:29:15 +00:00
|
|
|
Getting Started
|
|
|
|
===============
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
Installation
|
2018-01-02 15:29:15 +00:00
|
|
|
------------
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-02 15:29:15 +00:00
|
|
|
- You can easily install and upgrade the library using standard Python tools:
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-02 15:29:15 +00:00
|
|
|
.. code:: shell
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-03-11 18:32:22 +00:00
|
|
|
$ pip3 install --upgrade pyrogram
|
2018-02-17 15:44:54 +00:00
|
|
|
|
|
|
|
- Or, with TgCrypto_:
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
2018-03-11 18:32:22 +00:00
|
|
|
$ pip3 install --upgrade pyrogram[tgcrypto]
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-08 05:45:07 +00:00
|
|
|
Configuration
|
|
|
|
-------------
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2017-12-21 15:00:04 +00:00
|
|
|
- Create a new ``config.ini`` file at the root of your working directory, copy-paste
|
|
|
|
the following and replace the **api_id** and **api_hash** values with `your own`_:
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2017-12-21 15:00:04 +00:00
|
|
|
.. code:: ini
|
|
|
|
|
|
|
|
[pyrogram]
|
|
|
|
api_id = 12345
|
|
|
|
api_hash = 0123456789abcdef0123456789abcdef
|
|
|
|
|
2018-01-02 15:29:15 +00:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
- And here's how Pyrogram looks like:
|
2017-12-21 15:00:04 +00:00
|
|
|
|
|
|
|
.. code:: python
|
|
|
|
|
|
|
|
from pyrogram import Client
|
2018-01-08 05:45:07 +00:00
|
|
|
|
|
|
|
client = Client("example")
|
2017-12-21 15:00:04 +00:00
|
|
|
client.start()
|
2018-01-02 15:29:15 +00:00
|
|
|
|
2018-01-08 05:45:07 +00:00
|
|
|
client.send_message("me", "Hi there! I'm using Pyrogram")
|
|
|
|
client.send_photo("me", "/home/dan/pic.jpg", "Nice photo!")
|
|
|
|
|
2018-01-02 15:29:15 +00:00
|
|
|
client.stop()
|
2017-12-21 15:00:04 +00:00
|
|
|
|
|
|
|
That's all you need for getting started with Pyrogram. For more detailed information,
|
2018-01-08 07:23:25 +00:00
|
|
|
please refer to the Documentation_.
|
2017-12-21 15:00:04 +00:00
|
|
|
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2017-12-11 07:59:11 +00:00
|
|
|
Documentation
|
|
|
|
=============
|
|
|
|
|
2018-01-06 12:55:22 +00:00
|
|
|
- The entire Pyrogram's documentation resides at https://docs.pyrogram.ml.
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-08 05:45:07 +00:00
|
|
|
|
2017-12-10 19:43:31 +00:00
|
|
|
Contribution
|
|
|
|
============
|
|
|
|
|
2017-12-11 07:59:11 +00:00
|
|
|
**You are very welcome to contribute** by either submitting pull requests or
|
|
|
|
reporting issues/bugs as well as suggesting best practices, ideas, enhancements
|
|
|
|
on both code and documentation. Any help is appreciated!
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
Feedback
|
|
|
|
========
|
|
|
|
|
2017-12-11 07:59:11 +00:00
|
|
|
Means for getting in touch:
|
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
- `Community`_
|
2017-12-10 19:43:31 +00:00
|
|
|
- `Telegram`_
|
2017-12-15 08:48:14 +00:00
|
|
|
- `GitHub`_
|
2017-12-10 19:43:31 +00:00
|
|
|
- `Email`_
|
|
|
|
|
2017-12-17 13:22:03 +00:00
|
|
|
|
|
|
|
License
|
|
|
|
=======
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-01 12:44:33 +00:00
|
|
|
- Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
- Licensed under the terms of the
|
|
|
|
`GNU Lesser General Public License v3 or later (LGPLv3+)`_
|
|
|
|
|
|
|
|
|
|
|
|
.. _`Telegram Messenger API`: https://core.telegram.org/api#telegram-api
|
|
|
|
|
|
|
|
.. _`MTProto Mobile Protocol v2.0`: https://core.telegram.org/mtproto
|
|
|
|
|
2018-01-20 15:21:25 +00:00
|
|
|
.. _`Layer 75`: compiler/api/source/main_api.tl
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2017-12-21 15:00:04 +00:00
|
|
|
.. _`your own`: https://github.com/pyrogram/pyrogram/wiki/Getting-Started#api-keys
|
|
|
|
|
|
|
|
.. _`Introduction`: https://github.com/pyrogram/pyrogram/wiki/Getting-Started
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-01-02 15:29:15 +00:00
|
|
|
.. _`Telegram`: https://t.me/haskell
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
.. _`Community`: https://t.me/PyrogramChat
|
|
|
|
|
2017-12-10 19:43:31 +00:00
|
|
|
.. _`bot-like`: https://core.telegram.org/bots/api#available-methods
|
|
|
|
|
2017-12-15 08:48:14 +00:00
|
|
|
.. _`GitHub`: https://github.com/pyrogram/pyrogram/issues
|
2017-12-10 19:43:31 +00:00
|
|
|
|
|
|
|
.. _`Email`: admin@pyrogram.ml
|
|
|
|
|
2018-02-17 20:52:27 +00:00
|
|
|
.. _TgCrypto: https://github.com/pyrogram/tgcrypto
|
2018-02-17 14:35:49 +00:00
|
|
|
|
2017-12-10 19:43:31 +00:00
|
|
|
.. _`GNU Lesser General Public License v3 or later (LGPLv3+)`: COPYING.lesser
|
|
|
|
|
|
|
|
.. |header| raw:: html
|
|
|
|
|
|
|
|
<h1 align="center">
|
2017-12-12 09:49:44 +00:00
|
|
|
<a href="https://pyrogram.ml">
|
2017-12-27 18:20:17 +00:00
|
|
|
<div><img src="https://pyrogram.ml/images/icon.png" alt="Pyrogram Icon"></div>
|
|
|
|
<div><img src="https://pyrogram.ml/images/label.png" alt="Pyrogram Label"></div>
|
2017-12-10 19:43:31 +00:00
|
|
|
</a>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<p align="center">
|
|
|
|
<b>Telegram MTProto API Client Library for Python</b>
|
2017-12-21 15:00:04 +00:00
|
|
|
|
2017-12-17 13:22:03 +00:00
|
|
|
<br>
|
2018-02-17 14:35:49 +00:00
|
|
|
<a href="https://github.com/pyrogram/pyrogram/releases/latest">
|
2017-12-31 10:00:33 +00:00
|
|
|
Download
|
|
|
|
</a>
|
|
|
|
•
|
2017-12-30 20:51:51 +00:00
|
|
|
<a href="https://docs.pyrogram.ml">
|
|
|
|
Documentation
|
|
|
|
</a>
|
|
|
|
•
|
2018-01-07 12:11:14 +00:00
|
|
|
<a href="https://t.me/PyrogramChat">
|
2018-01-01 12:44:33 +00:00
|
|
|
Community
|
2018-02-19 14:12:19 +00:00
|
|
|
</a>
|
|
|
|
<br><br>
|
2017-12-12 09:49:44 +00:00
|
|
|
<a href="compiler/api/source/main_api.tl">
|
2017-12-18 14:02:19 +00:00
|
|
|
<img src="https://www.pyrogram.ml/images/scheme.svg"
|
2018-01-20 15:21:25 +00:00
|
|
|
alt="Scheme Layer 75">
|
2017-12-10 19:43:31 +00:00
|
|
|
</a>
|
2018-02-17 14:35:49 +00:00
|
|
|
<a href="https://github.com/pyrogram/tgcrypto">
|
|
|
|
<img src="https://www.pyrogram.ml/images/tgcrypto.svg"
|
|
|
|
alt="TgCrypto">
|
2017-12-10 19:43:31 +00:00
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
|
2017-12-12 09:49:44 +00:00
|
|
|
.. |logo| image:: https://pyrogram.ml/images/logo.png
|
|
|
|
:target: https://pyrogram.ml
|
2017-12-10 19:43:31 +00:00
|
|
|
:alt: Pyrogram
|
|
|
|
|
|
|
|
.. |description| replace:: **Telegram MTProto API Client Library for Python**
|
|
|
|
|
2017-12-18 14:02:19 +00:00
|
|
|
.. |scheme| image:: https://www.pyrogram.ml/images/scheme.svg
|
2017-12-12 09:49:44 +00:00
|
|
|
:target: compiler/api/source/main_api.tl
|
2018-01-20 15:21:25 +00:00
|
|
|
:alt: Scheme Layer 75
|
2017-12-10 19:43:31 +00:00
|
|
|
|
2018-02-17 14:35:49 +00:00
|
|
|
.. |tgcrypto| image:: https://www.pyrogram.ml/images/tgcrypto.svg
|
|
|
|
:target: https://github.com/pyrogram/tgcrypto
|
|
|
|
:alt: TgCrypto
|