Skip to content

AttributeError: 'str' object has no attribute 'get' when HTTP 5xx #306

@Patataman

Description

@Patataman

When the server responses with a 520 and 524 (afaik, maybe with other 5xx errors also happens)

if response.body and 'errors' in response.body:
self._details = kwargs.get('details', response.body.get('errors'))
else:
self._details = None

These lines return the error from the title because response.body is not a dictionary. A possible solution would be

if response.body and 'errors' in response.body:
    if type(response.body) is dict:
        self._details = kwargs.get('details', response.body.get('errors'))
    else:
        self._details = kwargs.get('details', [response.body])
else:
    self._details = None

But I don't know if response.body contains something useful to return as "details". As it is a server side error, I have no way to reproduce it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions