def __init__( self, max_retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504) ): self.max_retries = max_retries self.backoff_factor = backoff_factor self.status_forcelist = status_forcelist self._adapter = self._load_adapter(max_retries) self._middleware = Middleware()
def __init__( self, max_retries: int = 3, backoff_factor: float = 0.3, status_forcelist: typing.Tuple[int] = (500, 502, 504), ): self.max_retries = max_retries self.backoff_factor = backoff_factor self.status_forcelist = status_forcelist self._adapter = self._load_adapter(max_retries) self._middleware = Middleware()
def __init__( self, config: dict, transport: typing.Optional[Transport] = None, middleware: typing.Optional[Middleware] = None, ): cfg, cred = self._parse_dict_config(config) self.config = cfg self.credential = cred self.transport = transport or default_transport if middleware is None: middleware = Middleware() middleware.response(Client.logged_response_handler) self._middleware = middleware
def __init__(self, config, transport=None, middleware=None, logger=None): cfg, cred = self._parse_dict_config(config) self.config = cfg self.credential = cred self.transport = transport or default_transport self.logger = logger or log.default_logger if middleware is None: middleware = Middleware() middleware.response(self.logged_response_handler) middleware.request(self.logged_request_handler) self._middleware = middleware
def __init__( self, config: dict, transport: typing.Optional[Transport] = None, middleware: typing.Optional[Middleware] = None, logger: typing.Optional[logging.Logger] = None, ): cfg, cred = self._parse_dict_config(config) self.config = cfg self.credential = cred self.transport = transport or default_transport self.logger = logger or log.default_logger if middleware is None: middleware = Middleware() middleware.response(self.logged_response_handler) middleware.request(self.logged_request_handler) self._middleware = middleware