Skip to content

client.py does not properly handle 502 response #3

@gvauter

Description

@gvauter

Need to adjust handle_response logic to account for 502 responses. It appears Threat Stack sends back and HTML response for 502s.

Example:
{'_content': b'

502 Bad Gateway

\nThe server returned an invalid or incomplete response.\n\n', '_content_consumed': True, '_next': None, 'status_code': 502, 'headers': {'Cache-Control': 'no-cache', 'Connection': 'close', 'Content-Type': 'text/html'}, 'raw': <urllib3.response.HTTPResponse object at 0x10e3c52e8>, 'url': 'https://app.threatstack.com/api/v1/alerts?count=100&page=3', 'encoding': 'ISO-8859-1', 'history': [], 'reason': 'Bad Gateway', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(0, 120, 144756), 'request': <PreparedRequest [GET]>, 'connection': <requests.adapters.HTTPAdapter object at 0x10e3c5c50>}

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