When checking for the 403 'reason' here, there's an implicit assumption the data is already a dictionary. That's not always true: for example, here's some decoded data from the Google Monitoring API:
[{
u'error': {
u'status': u'PERMISSION_DENIED',
u'code': 403,
u'errors': [{...}
}]
This is (for whatever reason) a list, and so the code linked above fails with a TypeError (trying to index a list with a string), which is an uncaught exception.
When checking for the 403 'reason' here, there's an implicit assumption the data is already a dictionary. That's not always true: for example, here's some decoded data from the Google Monitoring API:
This is (for whatever reason) a list, and so the code linked above fails with a TypeError (trying to index a list with a string), which is an uncaught exception.