我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用requests.adapters.ConnectionError()。
def retrying_api_req(service, api_endpoint, access_token, *args, **kwargs): while True: try: response = api_req(service, api_endpoint, access_token, *args, **kwargs) if response: return response debug('retrying_api_req: api_req returned None, retrying') except (InvalidURL, ConnectionError, DecodeError), e: debug('retrying_api_req: request error ({}), retrying'.format( str(e))) time.sleep(1)