RequestHandler¶
- class luscious.RequestHandler(timeout: Tuple[float, float] = (5, 5), total: int = 5, status_forcelist: List[int] = [413, 429, 500, 502, 503, 504], backoff_factor: int = 1)¶
Defines a synchronous request handler class that provides methods and properties for working with REST APIs that is backed by the requests library.
- get(url: str, params: Optional[dict] = None, **kwargs) requests.models.Response¶
Returns the GET request encoded in utf-8. Adds proxies to this session on the fly if urllib is able to pick up the system’s proxy settings.
- post(url: str, params: Optional[dict] = None, **kwargs) requests.models.Response¶
Returns the POST request encoded in utf-8. Adds proxies to this session on the fly if urllib is able to pick up the system’s proxy settings.
- property retry_strategy: urllib3.util.retry.Retry¶
The retry strategy returns the retry configuration made up of the number of total retries, the status forcelist as well as the backoff factor. It is used in the session property where these values are passed to the HTTPAdapter.
- property session: requests.sessions.Session¶
Creates a custom session object. A request session provides cookie persistence, connection-pooling, and further configuration options that are exposed in the RequestHandler methods in form of parameters and keyword arguments.