refactor(session): rename LibroFmClient → LibroFmSession
Relocate API client from client.py to session.py with constructor injection. Transport is now passed once at construction time instead of per-method, eliminating 5 redundant httpx.Client creations per session lifecycle. - New session.py: LibroFmSession with shared _client, transport injected at construction, auth headers set once after authenticate() - Old client.py: deprecated re-export shim (LibroFmClient alias) - All endpoint signatures slimmed to ≤3 params (removed transport= from authenticate/fetch_library/fetch_m4b_url/ fetch_download_manifest/fetch_pdf_extra_url) - Updated all source imports (cli.py, downloader.py) and test files (test_client, test_downloader, test_cli, test_progress) - 17 new TDD tests in test_session.py Closes #27
This commit is contained in:
1 parent
fb219be248
commit
006a7561ce
11 files changed
+986
-413
No files matched your search
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
from rich.console import Console
|
||||
|
||||
from librofm_downloader.config import load_config, ConfigError, _resolve_config_file
|
||||
from librofm_downloader.client import LibroFmClient, AuthError
|
||||
from librofm_downloader.session import LibroFmSession, AuthError
|
||||
from librofm_downloader.history import DownloadHistory
|
||||
from librofm_downloader.book import Book
|
||||
from librofm_downloader.downloader import download_book
|
||||
@@ -96,7 +96,7 @@ def run(
|
||||
if verbose:
|
||||
console.print("[dim]── auth ────────────────────────────────────────[/dim]")
|
||||
|
||||
client = LibroFmClient(
|
||||
client = LibroFmSession(
|
||||
username=config.username,
|
||||
password=config.password,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user