Esempio n. 1
0
    def _get_body(self, response):
        body = response.json()
        #        error = body.get('error')
        status_code = response.status_code

        if status_code == 429:
            raise exceptions._OverQueryLimit(str(status_code), body)
        if status_code != 200:
            raise exceptions.ApiError(status_code, body)

        return body
Esempio n. 2
0
    def _get_body(response):
        """Returns the body of a response object, raises status code exceptions if necessary."""
        body = response.json()
        # error = body.get('error')
        status_code = response.status_code

        if status_code == 429:
            raise exceptions._OverQueryLimit(status_code, body)
        if status_code != 200:
            raise exceptions.ApiError(status_code, body)

        return body