(self, response)
Make sure there aren't any errors on the response.
Make sure there aren't any errors on the response.
Make sure there aren t any errors on the response .
def _check_response(self, response):
        """Make sure there aren't any errors on the response."""
        if 'error' in response:
            error = response.get('error', {})
            message = ("PassiveTotal: [HTTP %d] %s, %s" % (
                error.get('http_code', 500),
                error.get('message', 'Failed to grab message'),
                error.get('developer_message', 'Failed to grab message')
            ))
            logger.error(message)
            self._error(message)
            if error.get('http_code', 500) == 401:
                pt_site = 'https://www.passivetotal.org/enterprise'
                self._add_result('Invalid Authentication', pt_site,
                                 {'Message': message})
            if error.get('http_code', 500) == 403:
                pt_site = 'https://www.passivetotal.org/enterprise'
                self._add_result('Quota Reached', pt_site,
                                 {'Message': message})
def _check_response ( self , response ) : if 'error' in response : error = response . get ( 'error' , { } ) message = ( "PassiveTotal: [HTTP %d] %s, %s" % ( error . get ( 'http_code' , 500 ) , error . get ( 'message' , 'Failed to grab message' ) , error . get ( 'developer_message' , 'Failed to grab message' ) ) ) logger . error ( message ) self . _error ( message ) if error . get ( 'http_code' , 500 ) == 401 : pt_site = 'https://www.passivetotal.org/enterprise' self . _add_result ( 'Invalid Authentication' , pt_site , { 'Message' : message } ) if error . get ( 'http_code' , 500 ) == 403 : pt_site = 'https://www.passivetotal.org/enterprise' self . _add_result ( 'Quota Reached' , pt_site , { 'Message' : message } )