From d1d732d78d2b10b52209b2f5475e549a9103408e Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Wed, 2 Oct 2024 13:55:07 -0700 Subject: [PATCH] Small tweak when {} serializes to null which converts to None Flask 1 -> Flask 3 (#1764) --- pay-api/src/pay_api/services/auth.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pay-api/src/pay_api/services/auth.py b/pay-api/src/pay_api/services/auth.py index 4d0c4602c..72389a076 100644 --- a/pay-api/src/pay_api/services/auth.py +++ b/pay-api/src/pay_api/services/auth.py @@ -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