S VIVEGANANDAN commited on
Commit
e9f41c7
·
1 Parent(s): 0a048c4

Push latest changes from FileStreamBot-1

Browse files
Files changed (1) hide show
  1. test_multi_client.py +24 -0
test_multi_client.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import os
3
+ from pyrogram import Client
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+ API_ID = os.environ.get("API_ID")
8
+ API_HASH = os.environ.get("API_HASH")
9
+ BOT_TOKEN = os.environ.get("BOT_TOKEN")
10
+
11
+ async def main():
12
+ print(f"Testing with API_ID={API_ID}, BOT_TOKEN={BOT_TOKEN[:10]}...")
13
+ clients = []
14
+ for i in range(3):
15
+ c = Client(f"test_{i}", api_id=int(API_ID), api_hash=API_HASH, bot_token=BOT_TOKEN, in_memory=True)
16
+ await c.start()
17
+ print(f"Client {i} started, id={c.me.id}")
18
+ clients.append(c)
19
+
20
+ for c in clients:
21
+ await c.stop()
22
+ print("Stopped client")
23
+
24
+ asyncio.run(main())