mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
feat: Update base URL handling in Audiobookshelf client for consistent API requests
This commit is contained in:
@@ -49,7 +49,9 @@ class AudiobookshelfClient:
|
|||||||
if not config.library_id:
|
if not config.library_id:
|
||||||
raise ValueError("Audiobookshelf library ID is required")
|
raise ValueError("Audiobookshelf library ID is required")
|
||||||
self._config = config
|
self._config = config
|
||||||
self._base_url = config.normalized_base_url()
|
normalized = config.normalized_base_url() or ""
|
||||||
|
self._base_url = normalized.rstrip("/") or normalized
|
||||||
|
self._client_base_url = f"{self._base_url}/"
|
||||||
|
|
||||||
def _api_path(self, suffix: str = "") -> str:
|
def _api_path(self, suffix: str = "") -> str:
|
||||||
"""Join the API prefix with the provided suffix without losing proxies."""
|
"""Join the API prefix with the provided suffix without losing proxies."""
|
||||||
@@ -101,7 +103,7 @@ class AudiobookshelfClient:
|
|||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
}
|
}
|
||||||
return httpx.Client(
|
return httpx.Client(
|
||||||
base_url=self._base_url,
|
base_url=self._client_base_url,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
timeout=self._config.timeout,
|
timeout=self._config.timeout,
|
||||||
verify=self._config.verify_ssl,
|
verify=self._config.verify_ssl,
|
||||||
|
|||||||
Reference in New Issue
Block a user