nexusLIMS.utils.network#
Network and HTTP utilities for NexusLIMS.
Module Contents#
Functions#
Make a request from NexusLIMS. |
API#
- nexusLIMS.utils.network.nexus_req(url: str, function: str, *, retries: int = 5, token_auth: str | None = None, **kwargs: dict | None)[source]#
Make a request from NexusLIMS.
A helper method that wraps a function from
requests, but adds a local certificate authority chain to validate any custom certificates. Will automatically retry on transient server errors (502, 503, 504) with exponential backoff.- Parameters:
url – The URL to fetch
function – The function from the
requestslibrary to use (e.g.'GET','POST','PATCH', etc.)retries – The maximum number of retry attempts (total attempts = retries + 1)
token_auth – If a value is provided, it will be used as a token for authentication
**kwargs – Other keyword arguments are passed along to the
fn
- Returns:
r – A requests response object
- Return type: