Skip to content

Commit e6e71c9

Browse files
authored
Only check auth if there is auth (#451)
1 parent e5fc86b commit e6e71c9

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

client/verta/verta/client.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,24 +225,25 @@ def expt_runs(self):
225225
return self.expt.expt_runs
226226

227227
def _get_personal_workspace(self):
228-
response = _utils.make_request(
229-
"GET",
230-
"{}://{}/api/v1/uac-proxy/uac/getUser".format(self._conn.scheme, self._conn.socket),
231-
self._conn, params={'email': self._conn.auth['Grpc-Metadata-email']},
232-
)
228+
if self._conn.auth is not None:
229+
response = _utils.make_request(
230+
"GET",
231+
"{}://{}/api/v1/uac-proxy/uac/getUser".format(self._conn.scheme, self._conn.socket),
232+
self._conn, params={'email': self._conn.auth['Grpc-Metadata-email']},
233+
)
233234

234-
if response.ok:
235-
try:
236-
response_json = response.json()
237-
except ValueError: # not JSON response
238-
pass
239-
else:
240-
return response_json['verta_info']['username']
241-
else:
242-
if response.status_code == 404: # UAC not found
243-
pass
235+
if response.ok:
236+
try:
237+
response_json = response.json()
238+
except ValueError: # not JSON response
239+
pass
240+
else:
241+
return response_json['verta_info']['username']
244242
else:
245-
_utils.raise_for_http_error(response)
243+
if response.status_code == 404: # UAC not found
244+
pass
245+
else:
246+
_utils.raise_for_http_error(response)
246247
return _OSS_DEFAULT_WORKSPACE
247248

248249
def _load_config(self):

0 commit comments

Comments
 (0)