refactor(session): expose public transport property on LibroFmSession

Add @property transport getter that returns the underlying httpx
transport, replacing the single call site in downloader.py that
reached through session._client._transport. Encapsulates private
attribute access behind a public interface. 2 new tests.

Closes #38
This commit is contained in:
AlexKucera committed 2026-06-05 18:36:03 +02:00
1 parent de4c08cfd0
commit caca930c7c
5 files changed
+217 -3

No files matched your search

+1 -1
View File
@@ -261,7 +261,7 @@ def download_book(
if progress is None:
progress = reporter.update
cancel_event = reporter.cancel_event
transport = session._client._transport
transport = session.transport
# --- m4b_mp3_fallback: try M4B first, fall back to MP3 ---
if format_strategy == "m4b_mp3_fallback":
+5
View File
@@ -55,6 +55,11 @@ class LibroFmSession:
transport=transport,
)
@property
def transport(self) -> httpx.BaseTransport:
"""Return the underlying httpx transport for streaming downloads."""
return self._client._transport
def authenticate(self) -> str:
"""OAuth2 password grant → returns access_token.