-
Notifications
You must be signed in to change notification settings - Fork 6
/
telethon_test.py
33 lines (25 loc) · 954 Bytes
/
telethon_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import asyncio
import logging
from telethon import TelegramClient
from telethon.network.connection.tcpabridged import ConnectionTcpAbridged
from telethon.network.connection.tcpintermediate import ConnectionTcpIntermediate
from telethon.network.connection.tcpobfuscated import ConnectionTcpObfuscated
logging.basicConfig(level=logging.DEBUG)
# Remember to use your own values from my.telegram.org!
api_id = 12345
api_hash = "0123456789abcdef0123456789abcdef"
client = TelegramClient(
session=None,
api_id=api_id,
api_hash=api_hash,
# connection=ConnectionTcpAbridged, # ConnectionTcpObfuscated, # ConnectionTcpIntermediate,
)
async def main():
# Getting information about yourself
me = await client.get_me()
# "me" is a user object. You can pretty-print
# any Telegram object with the "stringify" method:
print(me.stringify())
await asyncio.Future()
with client:
client.loop.run_until_complete(main())