Skip to content

Commit 16e9b1f

Browse files
committed
More cleanly retry without SSL validation
Capture all function parameters and pass these as is to the function itself again, just now with the global `ca_check = False`.
1 parent 56b9169 commit 16e9b1f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

misc-tools/dj_utils.py.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ def do_api_request(endpoint: str, method: str = 'GET', jsonData: dict = {},
7070
cannot be JSON decoded.
7171
'''
7272

73+
# For the recursive call below to ignore SSL validation:
74+
orig_kwargs = locals()
75+
7376
if domjudge_api_url is None:
7477
result = api_via_cli(endpoint, method, {}, {}, jsonData)
7578
else:
@@ -104,7 +107,8 @@ def do_api_request(endpoint: str, method: str = 'GET', jsonData: dict = {},
104107
print('Can not verify certificate chain for DOMserver.')
105108
exit(1)
106109
else:
107-
return do_api_request(name)
110+
# Retry with SSL verification disabled
111+
return do_api_request(**orig_kwargs)
108112
except requests.exceptions.RequestException as e:
109113
raise RuntimeError(e)
110114
result = parse_api_response(endpoint, response)

0 commit comments

Comments
 (0)