Skip to content

Commit

Permalink
Update session.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Oct 8, 2023
1 parent 72c52a5 commit 04d9ed3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions session/session.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os
import sys
from pyrogram import Client
from dotenv import load_dotenv


if __name__ == "__main__":
current_dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(current_dir, "../.env")
load_dotenv(path)
try:
api_id = input("Enter your Telegram API ID: ")
api_hash = input("Enter your Telegram API HASH: ")

api_id = os.getenv("API_ID")
api_hash = os.getenv("API_HASH")

app = Client(":memory:", api_id=api_id, api_hash=api_hash)
with app:
print(app.export_session_string())
app = Client(":memory:", api_id=api_id, api_hash=api_hash)
with app:
print(app.export_session_string())
except KeyboardInterrupt:
pass
finally:
sys.exit(print("\n\nAborted!"))

0 comments on commit 04d9ed3

Please sign in to comment.