Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError returned when insufficient Authorization #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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