[ https://issues.apache.org/jira/browse/ATLAS-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Madhan Neethiraj resolved ATLAS-4676. ------------------------------------- Fix Version/s: 3.0.0 2.3.0 Resolution: Fixed > Atlas 401 response make Python client fail with JSON decode error > ----------------------------------------------------------------- > > Key: ATLAS-4676 > URL: https://issues.apache.org/jira/browse/ATLAS-4676 > Project: Atlas > Issue Type: Bug > Components: atlas-intg > Affects Versions: 2.1.0 > Reporter: Maxim Martynov > Priority: Major > Fix For: 3.0.0, 2.3.0 > > Time Spent: 20m > Remaining Estimate: 0h > > I've tried to use apache-atlas Python client to get an entity via API, but > passed wrong password. Instead of 401 HTTP error I've got: > {code:java} > ~/.local/lib/python3.7/site-packages/apache_atlas/client/entity.py in > get_entity_by_attribute(self, type_name, uniq_attributes, min_ext_info, > ignore_relationships) > 123 > 124 return > self.client.call_api(EntityClient.GET_ENTITY_BY_UNIQUE_ATTRIBUTE.format_path_with_params(type_name), > --> 125 AtlasEntityWithExtInfo, > query_params) > 126 > 127 def get_entities_by_guids(self, guids, min_ext_info=False, > ignore_relationships=False): > ~/.local/lib/python3.7/site-packages/apache_atlas/client/base_client.py in > call_api(self, api, response_type, query_params, request_obj) > 116 return None > 117 else: > --> 118 raise AtlasServiceException(api, response) > ~/.local/lib/python3.7/site-packages/apache_atlas/exceptions.py in > __init__(self, api, response) > 36 msg = "Metadata service API with url {url} and method > {method} : failed with status {status} and " \ > 37 "Response Body is :{response}". \ > ---> 38 format(**{'url': response.url, 'method': api.method, > 'status': status, 'response': response.json()}) > 39 > 40 Exception.__init__(self, msg) > /opt/anaconda/envs/jh-py37-conda/lib/python3.7/site-packages/requests/models.py > in json(self, **kwargs) > 898 # used. > 899 pass > --> 900 return complexjson.loads(self.text, **kwargs) > 901 > 902 @property > /opt/anaconda/envs/jh-py37-conda/lib/python3.7/json/__init__.py in loads(s, > encoding, cls, object_hook, parse_float, parse_int, parse_constant, > object_pairs_hook, **kw) > 346 parse_int is None and parse_float is None and > 347 parse_constant is None and object_pairs_hook is None and > not kw): > --> 348 return _default_decoder.decode(s) > 349 if cls is None: > 350 cls = JSONDecoder > /opt/anaconda/envs/jh-py37-conda/lib/python3.7/json/decoder.py in > decode(self, s, _w) > 335 > 336 """ > --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) > 338 end = _w(s, end).end() > 339 if end != len(s): > /opt/anaconda/envs/jh-py37-conda/lib/python3.7/json/decoder.py in > raw_decode(self, s, idx) > 353 obj, end = self.scan_once(s, idx) > 354 except StopIteration as err: > --> 355 raise JSONDecodeError("Expecting value", s, err.value) > from None > 356 return obj, end > JSONDecodeError: Expecting value: line 1 column 1 (char 0) {code} > This is caused by this line: > https://github.com/apache/atlas/blob/146835ef03158d87defa1ef082decf9e05becbb0/intg/src/main/python/apache_atlas/exceptions.py#L38 > Client can get not only JSON, but an empty string, or HTML page (if Atlas is > running behind nginx as a reverse proxy). -- This message was sent by Atlassian Jira (v8.20.10#820010)