mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-22 23:31:12 +02:00
support per-request headers
This commit is contained in:
parent
3cf315880d
commit
edf38edc3f
1 changed files with 6 additions and 2 deletions
|
|
@ -61,13 +61,17 @@ class SurfSenseClient:
|
|||
json: Any | None = None,
|
||||
data: dict[str, Any] | None = None,
|
||||
files: Any | None = None,
|
||||
headers: dict[str, str] | None = None,
|
||||
) -> Any:
|
||||
"""Send a request and return the parsed body, or raise ``ToolError``."""
|
||||
"""Send a request and return the parsed body, or raise ``ToolError``.
|
||||
|
||||
``headers`` overrides the client defaults for this call.
|
||||
"""
|
||||
# Omit unset query params: sending them empty makes the API parse ""
|
||||
# as a value (e.g. int("") on folder_id) and fail.
|
||||
if params is not None:
|
||||
params = {key: value for key, value in params.items() if value is not None}
|
||||
headers = self._auth_headers()
|
||||
headers = {**self._auth_headers(), **(headers or {})}
|
||||
try:
|
||||
response = await self._http.request(
|
||||
method,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue