Skip to content

Fix TypeError returned when insufficient Authorization#9

Open
middaugh wants to merge 1 commit intoIntuitDeveloper:masterfrom
middaugh:master
Open

Fix TypeError returned when insufficient Authorization#9
middaugh wants to merge 1 commit intoIntuitDeveloper:masterfrom
middaugh:master

Conversation

@middaugh
Copy link

@middaugh middaugh commented Jun 1, 2023

If app doesn't have authentication rights, then the code sends a type error. Fixed by wrapping casting response.content to string. User can then see the authorization error message in the app.

Example error that was previously returned:

Error: SampleOAuth2_UsingPythonClient\app\views.py", line 122, in qbo_request
return HttpResponse(b' '.join([response.content, str(response.status_code)]))
TypeError: sequence item 1: expected a bytes-like object, str found

If app doesn't have authentication rights, then the code sends a type error. Fixed by wrapping casting response.content to string -- user can then see the authorization error message in the app.

Error: SampleOAuth2_UsingPythonClient\app\views.py", line 122, in qbo_request
    return HttpResponse(b' '.join([response.content, str(response.status_code)]))
TypeError: sequence item 1: expected a bytes-like object, str found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant