Files
librofm-downloader/librofm_downloader/client.py
T
AlexKucera 006a7561ce 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
2026-06-04 15:27:11 +02:00

33 lines
764 B
Python

"""Deprecated re-export shim — import from ``librofm_downloader.session`` instead."""
import warnings
from .session import (
API_SEMAPHORE_CAPACITY,
AuthError,
LibroFmSession,
M4BUnavailableError,
)
warnings.warn(
"Import from 'librofm_downloader.session' instead of 'librofm_downloader.client'. "
"This shim will be removed in a future version.",
DeprecationWarning,
stacklevel=2,
)
# Backward-compatible alias
LibroFmClient = LibroFmSession
# Re-export DEFAULT_HEADERS for code that reads LibroFmClient.DEFAULT_HEADERS
DEFAULT_HEADERS = LibroFmSession.DEFAULT_HEADERS
__all__ = [
"LibroFmSession",
"LibroFmClient",
"AuthError",
"M4BUnavailableError",
"API_SEMAPHORE_CAPACITY",
"DEFAULT_HEADERS",
]