SampleOAuth2_UsingPythonClient
SampleOAuth2_UsingPythonClient copied to clipboard
Internal server error when qbo api call response not ok
trafficstars
To reproduce, revoke the token and then try to do an API call:
Internal Server Error: /quickbooks/qbo_request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/michiel/gh/pondersource/peppol-python-demo/quickbooks/views.py", line 122, in qbo_request
return HttpResponse(' '.join([response.content, str(response.status_code)]))
TypeError: sequence item 0: expected str instance, bytes found
Apparently response.content contains a bytes buffer and not a string?
Ah btw this is with intuit-oauth==1.2.3 and requests==2.25.1.
I didn't test it with intuit-oauth==1.1.1 and requests==2.19.1 which is what https://github.com/IntuitDeveloper/SampleOAuth2_UsingPythonClient/blob/master/requirements.txt#L1 still specifies. Not sure if that could have caused it?