@@ -47,7 +47,7 @@ def parse_api_response(name: str, response: requests.Response):
47
47
# We got a successful HTTP response. It worked. Return the full response
48
48
try :
49
49
result = json .loads (response .text )
50
- except json .decoder .JSONDecodeError as e :
50
+ except json .decoder .JSONDecodeError :
51
51
print (response .text )
52
52
raise RuntimeError (f'Failed to JSON decode the response for API request { name } ' )
53
53
@@ -87,7 +87,9 @@ def do_api_request(name: str, method: str = 'GET', jsonData: dict = {}):
87
87
response = requests .get (url , headers = headers , verify = ca_check , auth = auth )
88
88
elif method == 'PUT' :
89
89
response = requests .put (url , headers = headers , verify = ca_check , json = jsonData , auth = auth )
90
- except requests .exceptions .SSLError as e :
90
+ else :
91
+ raise RuntimeError ("Method not supported" )
92
+ except requests .exceptions .SSLError :
91
93
ca_check = not confirm (
92
94
"Can not verify certificate, ignore certificate check?" , False )
93
95
if ca_check :
@@ -99,6 +101,7 @@ def do_api_request(name: str, method: str = 'GET', jsonData: dict = {}):
99
101
raise RuntimeError (e )
100
102
return parse_api_response (name , response )
101
103
104
+
102
105
def upload_file (name : str , apifilename : str , file : str , data : dict = {}):
103
106
'''Upload the given file to the API at the given path with the given name.
104
107
@@ -128,7 +131,7 @@ def upload_file(name: str, apifilename: str, file: str, data: dict = {}):
128
131
try :
129
132
response = requests .post (
130
133
url , files = files , headers = headers , data = data , verify = ca_check )
131
- except requests .exceptions .SSLError as e :
134
+ except requests .exceptions .SSLError :
132
135
ca_check = not confirm (
133
136
"Can not verify certificate, ignore certificate check?" , False )
134
137
if ca_check :
0 commit comments