def _get(url, headers={}, params=None):
    """Tries to GET data from an endpoint using retries"""
    param_string = _foursquare_urlencode(params)
    for i in xrange(NUM_REQUEST_RETRIES):
        try:
            try:
                response = requests.get(url, headers=headers, params=param_string, verify=VERIFY_SSL)
                return _process_response(response)
            except requests.exceptions.RequestException as e:
                _log_and_raise_exception('Error connecting with foursquare API', e)
        except FoursquareException as e:
            # Some errors don't bear repeating
            if e.__class__ in [InvalidAuth, ParamError, EndpointError, NotAuthorized, Deprecated]: raise
            # If we've reached our last try, re-raise
            if ((i + 1) == NUM_REQUEST_RETRIES): raise
        time.sleep(1)
def _get ( url , headers = { } , params = None ) : param_string = _foursquare_urlencode ( params ) for i in xrange ( NUM_REQUEST_RETRIES ) : try : try : response = requests . get ( url , headers = headers , params = param_string , verify = VERIFY_SSL ) return _process_response ( response ) except requests . exceptions . RequestException as e : _log_and_raise_exception ( 'Error connecting with foursquare API' , e ) except FoursquareException as e : if e . __class__ in [ InvalidAuth , ParamError , EndpointError , NotAuthorized , Deprecated ] : raise if ( ( i + 1 ) == NUM_REQUEST_RETRIES ) : raise time . sleep ( 1 )
Tries to GET data from an endpoint using retries