(self, response, json_resp)
return json_data
Check for valid response.
Check for valid response.
Check for valid response .
def validate_response(self, response, json_resp):
        """Check for valid response."""
        if not json_resp:
            self.is_errored = False
            return response
        self.is_errored = True
        try:
            if response.status_code in [101, 401]:
                raise UnauthorizedError
            if response.status_code == 404:
                raise exceptions.ConnectionError
            json_data = response.json()
        except KeyError:
            pass
        except (AttributeError, ValueError) as error:
            raise BlinkBadResponse from error

        self.is_errored = False
        return json_data
def validate_response ( self , response , json_resp ) : if not json_resp : self . is_errored = False return response self . is_errored = True try : if response . status_code in [ 101 , 401 ] : raise UnauthorizedError if response . status_code == 404 : raise exceptions . ConnectionError json_data = response . json ( ) except KeyError : pass except ( AttributeError , ValueError ) as error : raise BlinkBadResponse from error self . is_errored = False return json_data