Skip to content

Commit 6232506

Browse files
committed
Fix TypeError returned when insufficient Authorization
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
1 parent 42bd1e6 commit 6232506

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎app/views.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def qbo_request(request):
119119
response = qbo_api_call(auth_client.access_token, auth_client.realm_id)
120120

121121
if not response.ok:
122-
return HttpResponse(' '.join([response.content, str(response.status_code)]))
122+
return HttpResponse(' '.join([str(response.content), str(response.status_code)]))
123123
else:
124124
return HttpResponse(response.content)
125125

0 commit comments

Comments
 (0)