-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbatch_launch.py
More file actions
45 lines (35 loc) · 1.33 KB
/
Copy pathbatch_launch.py
File metadata and controls
45 lines (35 loc) · 1.33 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
Launch multiple profiles sequentially from a JSON list.
Subscribe & save 50%: SAAS50 / MIN50 — https://multilogin.com
Usage:
export MLX_EMAIL="your@email.com"
export MLX_PASSWORD="your_password"
export MLX_PROFILES='[{"folder_id":"...","profile_id":"..."},{"folder_id":"...","profile_id":"..."}]'
python batch_launch.py
"""
import json
import os
import sys
import time
from mlx_client import start_profile, stop_profile, token_from_env
if __name__ == "__main__":
raw = os.environ.get("MLX_PROFILES", "[]")
try:
profiles = json.loads(raw)
except json.JSONDecodeError:
sys.exit("MLX_PROFILES must be valid JSON array")
if not profiles:
sys.exit("Set MLX_PROFILES with folder_id and profile_id pairs")
token = token_from_env()
results = []
for item in profiles:
folder_id = item.get("folder_id", "")
profile_id = item.get("profile_id", "")
if not folder_id or not profile_id:
results.append({"profile_id": profile_id, "status": "skipped"})
continue
port = start_profile(token, folder_id, profile_id)
time.sleep(2)
stop_profile(token, profile_id)
results.append({"profile_id": profile_id, "status": "ok", "port": port})
print(json.dumps({"launched": len(results), "results": results}, indent=2))