def request(method, url, retry=True, **kwargs): def fn(): response = dcos.http.request(method, url, **kwargs) sdk_utils.out('Got {} for {} {} (args: {})'.format( response.status_code, method.upper(), url, kwargs)) response.raise_for_status() return response if retry: return shakedown.wait_while_exceptions(lambda: fn()) else: return fn()
def request(method, url, retry=True, log_args=True, **kwargs): def fn(): response = dcos.http.request(method, url, **kwargs) if log_args: log.info('Got {} for {} {} (args: {})'.format( response.status_code, method.upper(), url, kwargs)) else: log.info('Got {} for {} {} ({} args)'.format( response.status_code, method.upper(), url, len(kwargs))) response.raise_for_status() return response if retry: return shakedown.wait_while_exceptions(lambda: fn()) else: return fn()
def request(method, url, retry=True, log_args=True, verify=None, **kwargs): def fn(): response = dcos.http.request(method, url, verify=verify, **kwargs) if log_args: log.info('Got {} for {} {} (args: {})'.format( response.status_code, method.upper(), url, kwargs)) else: log.info('Got {} for {} {} ({} args)'.format( response.status_code, method.upper(), url, len(kwargs))) response.raise_for_status() return response if retry: return shakedown.wait_while_exceptions(lambda: fn()) else: return fn()