Skip to content

Commit

Permalink
names adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloarocha committed Jan 23, 2025
1 parent 58af899 commit 87ba670
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions routes/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def proxy_name(idPatient):
config = _get_config(user)
token = _get_token(config)
getname_type = config["getname"].get("type", "proxy")
auth_prefix = config["getname"]["token"].get("authPrefix", "")

url = (
config["getname"]["urlDev"]
Expand All @@ -41,7 +42,7 @@ def proxy_name(idPatient):
try:
response = requests.get(
url,
headers={"Authorization": f"Bearer {token}"},
headers={"Authorization": f"{auth_prefix}{token}"},
params=params,
verify=False,
)
Expand Down Expand Up @@ -72,7 +73,6 @@ def proxy_name(idPatient):
logger.error(f"Service names ERROR: {response.status_code}")
logger.error(url)
logger.error(params)
logger.error(token)
logger.error(response.text)
logger.error(response.__dict__)
except Exception as e:
Expand Down Expand Up @@ -101,6 +101,7 @@ def proxy_multiple():
config = _get_config(user)
token = _get_token(config)
getname_type = config["getname"].get("type", "proxy")
auth_prefix = config["getname"]["token"].get("authPrefix", "")

url = (
config["getname"]["urlDev"]
Expand Down Expand Up @@ -129,7 +130,10 @@ def proxy_multiple():
**{"cd_paciente": " ".join(str(id) for id in ids_list)},
)
response = requests.get(
url, headers={"Authorization": token}, params=params, verify=False
url,
headers={"Authorization": f"{auth_prefix}{token}"},
params=params,
verify=False,
)

found = []
Expand All @@ -151,9 +155,10 @@ def proxy_multiple():
logging.basicConfig()
logger = logging.getLogger("noharm.backend")
logger.error(f"Service names error {response.status_code}")
logger.error(response.json())
logger.error(url)
logger.error(params)
logger.error(response.text)
logger.error(response.__dict__)

except Exception as e:
logging.basicConfig()
Expand Down

0 comments on commit 87ba670

Please sign in to comment.