- Added `.vscode` to `.gitignore` to exclude Visual Studio Code settings. - Updated `pyproject.toml` to include `ruff` for linting and configured its settings. - Modified `uv.lock` to include `ruff` in both optional and development dependencies. - Refactored type hints in several files to use `str | None` for optional parameters. - Cleaned up unused imports and whitespace in various modules for improved code clarity.
21 lines
571 B
Python
21 lines
571 B
Python
from requests.adapters import HTTPAdapter
|
|
from urllib3.util import Retry
|
|
|
|
|
|
class OxiAdapter(HTTPAdapter):
|
|
def __init__(
|
|
self,
|
|
timeout: int | None = None,
|
|
max_retries: int = 3,
|
|
*args,
|
|
**kwargs,
|
|
):
|
|
self.timeout = timeout
|
|
retry = Retry(total=max_retries, backoff_factor=0.3)
|
|
super().__init__(*args, max_retries=retry, **kwargs)
|
|
|
|
def send(self, request, **kwargs):
|
|
if kwargs.get("timeout") is None:
|
|
kwargs["timeout"] = self.timeout
|
|
return super().send(request, **kwargs)
|