kitir/kits/restful_api.py
def _request_get(cls, url, **kwargs):
        """sends a GET command using requests package"""
        ignore_request_timeout = kwargs.pop('ignore_request_timeout', False)
        ignore_connection_aborted = kwargs.pop('ignore_connection_aborted', False)
        log_action = kwargs.pop('log_action', True)
        session = kwargs.pop('session', None)
        kwargs.setdefault('timeout', cls.request_timeout)
        log_kwargs, kwargs = cls._extract_log_kwargs(**kwargs)
        if log_action:
            log.debug('request.get: url={}'.format(url))
        try:
            if session:
                r = session.get(url, **kwargs)
            else:
                r = requests.get(url, **kwargs)
        except requests.ReadTimeout as exc:
            if ignore_request_timeout:
                log.debug('Requests Timeout, ignored: url={} exc={}'.format(url, exc))
            else:
                raise
        except requests.ConnectionError as exc:
            if ignore_connection_aborted and 'Connection aborted.' in str(exc):
                log.debug('Connection Aborted, ignored: url={} exc={}'.format(url, exc))
            else:
                raise
        except requests.RequestException as exc:
            log.error('requests get exception: exc={} url={}'.format(exc, url))
            raise
        else:
            cls._log_transaction(r, **log_kwargs)
            return r
sends a GET command using requests package
sends a GET command using requests package
sends a GET command using requests package
def _request_get(cls, url, **kwargs):
        ignore_request_timeout = kwargs.pop('ignore_request_timeout', False)
        ignore_connection_aborted = kwargs.pop('ignore_connection_aborted', False)
        log_action = kwargs.pop('log_action', True)
        session = kwargs.pop('session', None)
        kwargs.setdefault('timeout', cls.request_timeout)
        log_kwargs, kwargs = cls._extract_log_kwargs(**kwargs)
        if log_action:
            log.debug('request.get: url={}'.format(url))
        try:
            if session:
                r = session.get(url, **kwargs)
            else:
                r = requests.get(url, **kwargs)
        except requests.ReadTimeout as exc:
            if ignore_request_timeout:
                log.debug('Requests Timeout, ignored: url={} exc={}'.format(url, exc))
            else:
                raise
        except requests.ConnectionError as exc:
            if ignore_connection_aborted and 'Connection aborted.' in str(exc):
                log.debug('Connection Aborted, ignored: url={} exc={}'.format(url, exc))
            else:
                raise
        except requests.RequestException as exc:
            log.error('requests get exception: exc={} url={}'.format(exc, url))
            raise
        else:
            cls._log_transaction(r, **log_kwargs)
            return r
def _request_get ( cls , url , ** kwargs ) : ignore_request_timeout = kwargs . pop ( 'ignore_request_timeout' , False ) ignore_connection_aborted = kwargs . pop ( 'ignore_connection_aborted' , False ) log_action = kwargs . pop ( 'log_action' , True ) session = kwargs . pop ( 'session' , None ) kwargs . setdefault ( 'timeout' , cls . request_timeout ) log_kwargs , kwargs = cls . _extract_log_kwargs ( ** kwargs ) if log_action : log . debug ( 'request.get: url={}' . format ( url ) ) try : if session : r = session . get ( url , ** kwargs ) else : r = requests . get ( url , ** kwargs ) except requests . ReadTimeout as exc : if ignore_request_timeout : log . debug ( 'Requests Timeout, ignored: url={} exc={}' . format ( url , exc ) ) else : raise except requests . ConnectionError as exc : if ignore_connection_aborted and 'Connection aborted.' in str ( exc ) : log . debug ( 'Connection Aborted, ignored: url={} exc={}' . format ( url , exc ) ) else : raise except requests . RequestException as exc : log . error ( 'requests get exception: exc={} url={}' . format ( exc , url ) ) raise else : cls . _log_transaction ( r , ** log_kwargs ) return r
sends a GET command using requests package
sends a GET command using requests package
"""sends a GET command using requests package"""
cls
url