This commit is contained in:
Vlad
2024-09-21 03:08:57 +03:00
parent 9c2b732d55
commit 9413065ea3
10 changed files with 62 additions and 44 deletions
+7 -4
View File
@@ -1,7 +1,10 @@
import json
from config import API_URL
def add_client(session, client_id: str, email: str, tg_id: str, limit_ip: int, total_gb: int, expiry_time: int, enable: bool, flow: str):
url = 'https://solonet.pocomacho.ru:62553/solonet/panel/api/inbounds/addClient'
url = f'{API_URL}/panel/api/inbounds/addClient'
email = email.lower()
@@ -41,7 +44,7 @@ def add_client(session, client_id: str, email: str, tg_id: str, limit_ip: int, t
print(f"Ошибка при добавлении клиента: {response.status_code}, {response.text}")
def extend_client_key(session, tg_id, client_id, email: str, new_expiry_time: int) -> bool:
response = session.get(f"https://solonet.pocomacho.ru:62553/solonet/panel/api/inbounds/getClientTraffics/{email}")
response = session.get(f"{API_URL}/panel/api/inbounds/getClientTraffics/{email}")
print(f"GET {response.url} Status: {response.status_code}")
print(f"GET Response: {response.text}")
@@ -89,7 +92,7 @@ def extend_client_key(session, tg_id, client_id, email: str, new_expiry_time: in
}
try:
response = session.post(f"https://solonet.pocomacho.ru:62553/solonet/panel/api/inbounds/updateClient/{client_id}", json=payload, headers=headers)
response = session.post(f"{API_URL}/panel/api/inbounds/updateClient/{client_id}", json=payload, headers=headers)
print(f"POST {response.url} Status: {response.status_code}")
print(f"POST Request Data: {json.dumps(payload, indent=2)}")
print(f"POST Response: {response.text}")
@@ -104,7 +107,7 @@ def extend_client_key(session, tg_id, client_id, email: str, new_expiry_time: in
return False
def delete_client(session, client_id: str) -> bool:
url = f"https://solonet.pocomacho.ru:62553/solonet/panel/api/inbounds/1/delClient/{client_id}"
url = f"{API_URL}/panel/api/inbounds/1/delClient/{client_id}"
headers = {
'Accept': 'application/json'
}