Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anton Grigoryev 2015-03-11 19:56:06 +03:00
commit af886b98eb
2 changed files with 73 additions and 0 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# JetBrains IDE
.idea/
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]

70
README.md Normal file
View File

@ -0,0 +1,70 @@
[![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)
# About this repo
This is Telegram API for python.
Main aim is to implement MTProto protocol Telegram API on pure Python (not wrapped CLI)
### Future plan
- [ ] We'll try to make it work on Python 2 as well as 3.
- [ ] Follow up the same functionality of CLI API.
- [ ] Serialize/Deserialize
- [ ] 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
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.
# Structure
- mtproto.py
- testing.py
- prime.py
- credentials
- rsa.pub
## Credentials
Repo doesn't contain any credentials to connect Telegram servers.
You can get yours from http://my.telegram.org
You should place 2 files in the root of your repo:
- credentials
- rsa.pub
Config example for "credentials" file:
```
[App data]
api_id: 12345
api_hash: 1234567890abcdef1234567890abcdef
ip_address: 112.134.156.178
port: 443
```
rsa.pub contains your RSA key.
## mtproto.py
Contains functions to work with MTproto protocol:
- TL schema parsing
- serializing and deserializing
- manage connections to server
- send and receive messages
## testing.py
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
## 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