Fix AutoDL GET request parameters
Controller CI / test (push) Successful in 2s

This commit is contained in:
2026-10-02 15:18:31 +08:00
parent d5f13caee0
commit c7c4850e14
2 changed files with 23 additions and 2 deletions
+10 -2
View File
@@ -14,6 +14,7 @@ import sys
import tempfile
import time
import urllib.error
import urllib.parse
import urllib.request
from dataclasses import dataclass
from pathlib import Path
@@ -144,9 +145,16 @@ class AutoDLClient:
self.token = token
def request(self, method: str, path: str, body: dict[str, Any]) -> Any:
url = f"{API_BASE}{path}"
data: bytes | None
if method == "GET":
url = f"{url}?{urllib.parse.urlencode(body)}"
data = None
else:
data = json.dumps(body).encode()
request = urllib.request.Request(
f"{API_BASE}{path}",
data=json.dumps(body).encode(),
url,
data=data,
method=method,
headers={"Authorization": self.token, "Content-Type": "application/json"},
)