forked from Wachu985/Session-String-Pyrogram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession_string_pyrogram.py
More file actions
executable file
·30 lines (22 loc) · 955 Bytes
/
session_string_pyrogram.py
File metadata and controls
executable file
·30 lines (22 loc) · 955 Bytes
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
from pyrogram import Client
import asyncio
async def stringGenerate():
api_id = input("Api ID: \n")
api_hash = input("Api Hash: \n")
client = Client("memory", api_id, api_hash)
await client.connect()
phone_number = input("Insert your phone number: \nIncluding Country code. Example: +5357653423 \n")
print("Sending code to telegram... \n")
code = await client.send_code(phone_number)
phone_code_msg = input("Insert registration code: \n")
try:
print('Login in Telegram...')
await client.sign_in(phone_number, code.phone_code_hash, phone_code_msg)
except:
password = input('Insert your double factor:\n')
await client.check_password(password=password)
print("Session String: ")
string_session = await client.export_session_string()
print(f"Session String:\n{string_session}")
if __name__ == "__main__":
asyncio.run(stringGenerate())