Spaces:
Running
Running
Create multi_client.py
Browse files- multi_client.py +38 -0
multi_client.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import os
|
3 |
+
import subprocess
|
4 |
+
import sys
|
5 |
+
|
6 |
+
vars = ["API_ID", "API_HASH", "SESSION"]
|
7 |
+
|
8 |
+
def _check(z):
|
9 |
+
new = []
|
10 |
+
for var in vars:
|
11 |
+
ent = os.environ.get(var + z)
|
12 |
+
if not ent:
|
13 |
+
return False, new
|
14 |
+
new.append(ent)
|
15 |
+
return True, new
|
16 |
+
|
17 |
+
for z in range(5):
|
18 |
+
n = str(z + 1)
|
19 |
+
if z == 0:
|
20 |
+
z = ""
|
21 |
+
fine, out = _check(str(z))
|
22 |
+
if fine:
|
23 |
+
subprocess.Popen(
|
24 |
+
[sys.executable, "-m", "xteam", out[0], out[1], out[2], out[3], out[4], n],
|
25 |
+
stdin=None,
|
26 |
+
stderr=None,
|
27 |
+
stdout=None,
|
28 |
+
cwd=None,
|
29 |
+
)
|
30 |
+
|
31 |
+
loop = asyncio.get_event_loop()
|
32 |
+
|
33 |
+
try:
|
34 |
+
loop.run_forever()
|
35 |
+
except Exception as er:
|
36 |
+
print(er)
|
37 |
+
finally:
|
38 |
+
loop.close()
|