Skip to content

Commit

Permalink
add 403 return code to get service (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroroiz committed Aug 22, 2024
1 parent 36eb7df commit 373dde8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.4

* add 403 as a valid response code for get_service call

## 2.5.3

* upgrade to python3.10
Expand Down
6 changes: 5 additions & 1 deletion confidant_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def get_service(self, service, decrypt_blind=False, metadata_only=False):
response = self._execute_request(
'get',
'{0}/v1/services/{1}'.format(self.config['url'], service),
expected_return_codes=[200, 404],
expected_return_codes=[200, 403, 404],
params={'metadata_only': metadata_only},
)
except RequestExecutionError:
Expand All @@ -322,6 +322,10 @@ def get_service(self, service, decrypt_blind=False, metadata_only=False):
logging.debug('Service not found in confidant.')
ret['result'] = True
return ret
if response.status_code == 403:
logging.debug('Access denied to service in confidant.')
ret = {**ret, **response.json()}
return ret
try:
data = response.json()
if decrypt_blind:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name="confidant-client",
version="2.5.3",
version="2.5.4",
packages=find_packages(exclude=["test*"]),
install_requires=[
# Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK)
Expand Down

0 comments on commit 373dde8

Please sign in to comment.