Skip to content

Commit

Permalink
Small tweak when {} serializes to null which converts to None Flask 1…
Browse files Browse the repository at this point in the history
… -> Flask 3 (#1764)
  • Loading branch information
seeker25 authored Oct 2, 2024
1 parent 83380c1 commit d1d732d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pay-api/src/pay_api/services/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ def check_auth(business_identifier: str, account_id: str = None, corp_type_code:
if corp_type_code:
additional_headers = {'Product-Code': product_code}
auth_response = RestService.get(auth_url, bearer_token, AuthHeaderType.BEARER, ContentType.JSON,
additional_headers=additional_headers).json()
additional_headers=additional_headers).json() or {}
roles: list = auth_response.get('roles', [])
g.account_id = account_id
elif business_identifier:
auth_url = current_app.config.get(
'AUTH_API_ENDPOINT') + f'entities/{business_identifier}/authorizations?expanded=true'
auth_response = RestService.get(auth_url, bearer_token, AuthHeaderType.BEARER, ContentType.JSON).json()
auth_response = RestService.get(auth_url, bearer_token, AuthHeaderType.BEARER,
ContentType.JSON).json() or {}

roles: list = auth_response.get('roles', [])
g.account_id = auth_response.get('account').get('id') if auth_response.get('account', None) else None
Expand Down

0 comments on commit d1d732d

Please sign in to comment.