Skip to content

Commit

Permalink
Client: refactor constructor to improve static type checking; rucio#6588
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimaio committed Apr 26, 2024
1 parent 2c389be commit 3642ad6
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions lib/rucio/client/baseclient.py
Expand Up @@ -117,9 +117,17 @@ def __init__(self,
if self.script_id == '': # Python interpreter used
self.script_id = 'python'
try:
if self.host is None:
if rucio_host is not None:
self.host = rucio_host
else:
self.host = config_get('client', 'rucio_host')
if self.auth_host is None:
except (NoOptionError, NoSectionError) as error:
raise MissingClientParameter('Section client and Option \'%s\' cannot be found in config file' % error.args[0])

try:
if auth_host is not None:
self.auth_host = auth_host
else:
self.auth_host = config_get('client', 'auth_host')
except (NoOptionError, NoSectionError) as error:
raise MissingClientParameter('Section client and Option \'%s\' cannot be found in config file' % error.args[0])
Expand Down Expand Up @@ -318,9 +326,12 @@ def _get_exception(self, headers: dict[str, str], status_code: Optional[int] = N
:return: A rucio exception class and an error string.
"""
try:
data = parse_response(data)
except ValueError:
if data is not None:
try:
data = parse_response(data)
except ValueError:
data = {}
else:
data = {}

exc_cls = 'RucioException'
Expand Down

0 comments on commit 3642ad6

Please sign in to comment.