1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 10:59:02 +01:00
Go to file
Anton Grigoryev 308b76fce1 Now deserialized answer is an object.
name = tl_elem.predicate
It can help us  avoid keys collision in case of TL element has parameter "name"
2015-04-11 09:43:13 +03:00
classes testing.py now shares Telepy class with TelepyShell 2015-03-23 03:08:49 +09:00
tests delete something 2015-04-04 21:42:02 +08:00
.gitignore Add auth error handling 2015-04-04 15:18:45 +08:00
crypt.py Some bytearrays were replaced with bytes. 2015-03-17 20:26:22 +03:00
mtproto.py Now deserialized answer is an object. 2015-04-11 09:43:13 +03:00
prime.py crypt module refactor. need to be tested in py2 2015-03-16 17:59:59 +03:00
README.md try to commit from new machine 2015-03-17 14:40:37 +03:00
telepy.py testing.py now shares Telepy class with TelepyShell 2015-03-23 03:08:49 +09:00
testing.py Test with py3 2015-04-04 21:39:26 +08:00
TL_schema.JSON TL Schema moved to JSON mode. 2015-03-11 19:58:26 +03:00
TL.py Now deserialized answer is an object. 2015-04-11 09:43:13 +03:00

Join the chat at https://gitter.im/griganton/telepy

About this repo

This is Telegram API for python. Main aim is to implement MTProto protocol Telegram API on pure Python (not wrapped CLI)

Plan

  • 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]
    • Send and receive service messages with server like logging in to server [doc]

Useful start points to join

Detailed description of API and protocol can be found here:

API registration is needed to be done by yourself at http://my.telegram.org Follow Structure - Credentials for provide it your API information.

Structure

  • tests
  • Serialization and SHA.py
  • 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