feat: add files uploading; add banner updating

This commit is contained in:
firedotguy
2026-01-29 23:39:35 +03:00
parent 10751f9ddb
commit f1d9a0b2f0
5 changed files with 20 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ from requests import Session
s = Session()
def fetch(token: str, method: str, url: str, params: dict = {}, files: list = []):
def fetch(token: str, method: str, url: str, params: dict = {}, files: dict[str, tuple[str, bytes]] = {}):
base = f'https://xn--d1ah4a.com/api/{url}'
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
@@ -23,7 +23,7 @@ def fetch(token: str, method: str, url: str, params: dict = {}, files: list = []
}
method = method.lower()
if method == "get":
res = s.get(base, timeout=20, params=params, headers=headers)
res = s.get(base, timeout=120 if files else 20, params=params, headers=headers)
else:
res = s.request(method.upper(), base, timeout=20, json=params, headers=headers, files=files)