1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 09:14:39 +01:00
MadelineProto/testing.py

28 lines
684 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
import os
import io
import struct
# Deal with py2 and py3 differences
try: # this only works in py2.7
import configparser
except ImportError:
import ConfigParser as configparser
import mtproto
2015-03-11 23:52:26 +01:00
config = configparser.ConfigParser()
# Check if credentials is correctly loaded (when it doesn't read anything it returns [])
if not config.read('credentials'):
print("File 'credentials' seems to not exist.")
exit(-1)
ip = config.get('App data', 'ip_address')
port = config.getint('App data', 'port')
Session = mtproto.Session(ip, port)
2015-04-04 09:18:45 +02:00
Session.create_auth_key()
future_salts = Session.method_call('get_future_salts', num=3)
2015-04-04 09:18:45 +02:00
print(future_salts)