-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72c52a5
commit 04d9ed3
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!")) |