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
json.decoder.JSONDecodeError on csv (res) content #1570
Comments
Hi @gparonitti , Thank you for reporting this bug and proposing a fix. PRs are welcome! (Please include a test as well to avoid future regressions.) |
@parthea np. |
test: copes with possible future regressions
test: copes with possible future regressions
Environment details
google-api-python-client
version: 2.26.1Steps to reproduce
Trying to use
generateCSV
api fromadsense.accounts.reports.saved.generateCsv
, but it might be a more general issue with non json format content.Code example
Stack trace
Possible cause
The code involved is in
googleapiclient/model.py
and the class isJsonModel(BaseModel)
specifically this part of code (275-283):The problem appears when the content of response is not in json format (with generateCsv api the content is csv text) so it produces the JSONDecodeError.
Possible patch
One of the following could work:
The text was updated successfully, but these errors were encountered: