MadelineProto/README.md

73 lines
2.3 KiB
Markdown
Raw Normal View History

[![Join the chat at https://gitter.im/griganton/telepy](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/griganton/telepy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2015-03-11 16:42:20 +01:00
# About this repo
This is Telegram API for python.
Main aim is to implement MTProto protocol Telegram API on pure Python (not wrapped CLI)
2015-03-12 19:28:13 +01:00
### Plan
- [ ] Make it work on Python 2 as well as 3.
2015-03-11 17:54:52 +01:00
- [ ] Follow up the same functionality of CLI API.
2015-03-12 19:28:13 +01:00
- [x] Serialize/Deserialize
2015-03-17 12:40:37 +01:00
- [x] Send and receive PQ authorization with server [[doc]](https://core.telegram.org/mtproto/samples-auth_key)
- [ ] Send and receive service messages with server like logging in to server [[doc]](https://core.telegram.org/mtproto/service_messages)
### Useful start points to join
2015-03-11 17:05:34 +01:00
Detailed description of API and protocol can be found here:
* https://core.telegram.org/api
* https://core.telegram.org/mtproto
API registration is needed to be done by yourself at http://my.telegram.org
Follow Structure - Credentials for provide it your API information.
2015-03-11 16:42:20 +01:00
2015-03-11 17:05:34 +01:00
# Structure
2015-03-13 13:48:10 +01:00
- tests
2015-03-13 13:48:33 +01:00
- Serialization and SHA.py
2015-03-11 17:05:34 +01:00
- mtproto.py
- testing.py
- prime.py
- credentials
- rsa.pub
## Credentials
2015-03-11 16:42:20 +01:00
Repo doesn't contain any credentials to connect Telegram servers.
2015-03-11 17:05:34 +01:00
You can get yours from http://my.telegram.org
2015-03-11 16:42:20 +01:00
2015-03-11 17:05:34 +01:00
You should place 2 files in the root of your repo:
2015-03-11 16:42:20 +01:00
- credentials
- rsa.pub
Config example for "credentials" file:
```
[App data]
api_id: 12345
api_hash: 1234567890abcdef1234567890abcdef
2015-03-11 17:21:30 +01:00
ip_address: 112.134.156.178
2015-03-11 16:42:20 +01:00
port: 443
```
rsa.pub contains your RSA key.
2015-03-11 17:05:34 +01:00
## mtproto.py
Contains functions to work with MTproto protocol:
- TL schema parsing
- serializing and deserializing
- manage connections to server
- send and receive messages
2015-03-11 16:42:20 +01:00
2015-03-11 17:05:34 +01:00
## testing.py
2015-03-11 16:42:20 +01:00
testing.py is used to test functionality of modules.
Now it makes steps from https://core.telegram.org/mtproto/samples-auth_key:
- sends PQ request to server
- parses the result
- factorizes PQ
2015-03-11 17:05:34 +01:00
## prime.py
prime.py is used in PQ factorization. It has been copied from https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
## TL schema
We use JSON format TL Shema. TL Schema file contains information about objects and methods, it is located in TL_schema.JSON file in the root of repo. It is fully equivalent to JSON TL Schema from
https://core.telegram.org/schema/mtproto-json