SampleOAuth2_UsingPythonClient icon indicating copy to clipboard operation
SampleOAuth2_UsingPythonClient copied to clipboard

Response Exception error

Open ocman-nazir-briet opened this issue 2 years ago • 0 comments
trafficstars

ISSUE:

try:
        response = auth_client.get_user_info()
    except ValueError:
        return HttpResponse('id_token or access_token not found.')
    except AuthClientError as e:
        print(e.status_code)
        print(e.intuit_tid)
    return HttpResponse(response.content)

Below is the fixed code for issue

_# if there is no response then it throws an error so we need to put a check here so that if there is no response we can return message_
try:
        response = auth_client.get_user_info()
    except ValueError:
        return HttpResponse('id_token or access_token not found.')
    except AuthClientError as e:
        print(e.status_code)
        print(e.intuit_tid)
    if response:
        return HttpResponse(response.content)
    else:
        return HttpResponse('Something Went Wrong!')

ocman-nazir-briet avatar Aug 01 '23 18:08 ocman-nazir-briet