forked from mtusi2026/mtusi2026lab2
feat: add swagger
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ def call(method, path, body=None, headers=None):
|
||||
content_type = {'Content-Type': 'application/json'} if data else {}
|
||||
request = urllib.request.Request(BASE + path, data=data, method=method, headers={**content_type, **(headers or {})})
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=5) as response:
|
||||
with urllib.request.urlopen(request, timeout=15) as response:
|
||||
return response.status, json.loads(response.read() or b'null')
|
||||
except urllib.error.HTTPError as error:
|
||||
return error.code, json.loads(error.read() or b'null')
|
||||
|
||||
Reference in New Issue
Block a user