Clients
Client and AsyncClient share the same interface: every method that talks to the API
is a coroutine on AsyncClient.
DEFAULT_BASE_URL: str = 'https://mybluray.fr'
Base URL of the public MyBluray API.
DEFAULT_TIMEOUT: float = 15.0
Default request timeout, in seconds.
DEFAULT_MAX_RETRIES: int = 2
Default number of retries on transient errors (429, 502, 503, 504).
Client
Client(
base_url: str = DEFAULT_BASE_URL,
*,
timeout: float = DEFAULT_TIMEOUT,
max_retries: int = DEFAULT_MAX_RETRIES,
client: Client | None = None,
)
Synchronous client for the public MyBluray API.
Use it as a context manager so the connection is always closed.
Network errors, HTTP 429 and HTTP 502/503/504 are retried automatically
(see max_retries). Any other failure raises a subclass of
JaquetteException.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Root URL of the API. Defaults to
|
DEFAULT_BASE_URL
|
timeout
|
float
|
Timeout in seconds, applied separately to connecting, writing,
reading and acquiring a connection (not to the whole request).
Defaults to |
DEFAULT_TIMEOUT
|
max_retries
|
int
|
Extra attempts after a network error, a 429 or a
502/503/504. Use |
DEFAULT_MAX_RETRIES
|
client
|
Client | None
|
An existing |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> with Client() as client:
... product = client.get_product("3333290016961")
... results = client.search("Breaking Bad")
get_product
get_product(isbn: str) -> ProductResponse
Fetch a cover art record by its ISBN/EAN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
isbn
|
str
|
The barcode, as a string of 8 to 14 digits without hyphens or spaces. Pass a string, not an integer: leading zeros are significant. |
required |
Returns:
| Type | Description |
|---|---|
ProductResponse
|
The full record: title, release year, publisher, media type, price, |
ProductResponse
|
cast, genres, cover image URL, the DVDFr page and the barcode image |
ProductResponse
|
( |
Raises:
| Type | Description |
|---|---|
InvalidISBNError
|
The ISBN is malformed (no request is sent). |
NotFoundError
|
No product matches this barcode (HTTP 404). |
BadRequestError
|
The API rejected the request (HTTP 400 or 422). |
RateLimitError
|
Too many requests, after retries (see |
ServerError
|
The API failed (HTTP 5xx), after retries. |
APIError
|
Any other HTTP error (parent of the four errors above). |
NetworkError
|
The request could not be completed, after retries. |
InvalidResponseError
|
The response does not match the expected schema. |
Examples:
search
search(
query: str,
*,
media: str | Sequence[str] | None = None,
editeur: str | Sequence[str] | None = None,
genre: str | Sequence[str] | None = None,
parution_min: date | str | None = None,
parution_max: date | str | None = None,
) -> SearchResponse
Fetch the editions available for a movie or TV series title.
The result can be iterated directly (for item in results). Always check
truncated before treating the list as complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The title to search for, at least 2 characters. |
required |
media
|
str | Sequence[str] | None
|
Keep only these media types, for example |
None
|
editeur
|
str | Sequence[str] | None
|
Keep only these publishers. |
None
|
genre
|
str | Sequence[str] | None
|
Keep only these DVDFr genres. |
None
|
parution_min
|
date | str | None
|
Earliest release date of the edition (a |
None
|
parution_max
|
date | str | None
|
Latest release date of the edition (same format). |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
A |
SearchResponse
|
DVD, Blu-ray, 4K...), |
SearchResponse
|
included), |
SearchResponse
|
|
SearchResponse
|
list is incomplete). |
Raises:
| Type | Description |
|---|---|
InvalidQueryError
|
The query is too short or not a string, or a date is malformed (no request is sent). |
BadRequestError
|
The API rejected the query, for example when it is too short (HTTP 400). |
RateLimitError
|
Too many requests, after retries (see |
ServerError
|
The API or DVDFr failed (HTTP 5xx), after retries. |
NetworkError
|
The request could not be completed, after retries. |
InvalidResponseError
|
The response does not match the expected schema. |
Examples:
AsyncClient
AsyncClient(
base_url: str = DEFAULT_BASE_URL,
*,
timeout: float = DEFAULT_TIMEOUT,
max_retries: int = DEFAULT_MAX_RETRIES,
client: AsyncClient | None = None,
)
Asynchronous client for the public MyBluray API.
Same interface as Client, but every method that
talks to the API is a coroutine. Use it as an async context manager so the
connection is always closed.
Network errors, HTTP 429 and HTTP 502/503/504 are retried automatically
(see max_retries). Any other failure raises a subclass of
JaquetteException.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Root URL of the API. Defaults to
|
DEFAULT_BASE_URL
|
timeout
|
float
|
Timeout in seconds, applied separately to connecting, writing,
reading and acquiring a connection (not to the whole request).
Defaults to |
DEFAULT_TIMEOUT
|
max_retries
|
int
|
Extra attempts after a network error, a 429 or a
502/503/504. Use |
DEFAULT_MAX_RETRIES
|
client
|
AsyncClient | None
|
An existing |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> async with AsyncClient() as client:
... product = await client.get_product("3333290016961")
... results = await client.search("Breaking Bad")
get_product
async
get_product(isbn: str) -> ProductResponse
Fetch a cover art record by its ISBN/EAN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
isbn
|
str
|
The barcode, as a string of 8 to 14 digits without hyphens or spaces. Pass a string, not an integer: leading zeros are significant. |
required |
Returns:
| Type | Description |
|---|---|
ProductResponse
|
The full record: title, release year, publisher, media type, price, |
ProductResponse
|
cast, genres, cover image URL, the DVDFr page and the barcode image |
ProductResponse
|
( |
Raises:
| Type | Description |
|---|---|
InvalidISBNError
|
The ISBN is malformed (no request is sent). |
NotFoundError
|
No product matches this barcode (HTTP 404). |
BadRequestError
|
The API rejected the request (HTTP 400 or 422). |
RateLimitError
|
Too many requests, after retries (see |
ServerError
|
The API failed (HTTP 5xx), after retries. |
APIError
|
Any other HTTP error (parent of the four errors above). |
NetworkError
|
The request could not be completed, after retries. |
InvalidResponseError
|
The response does not match the expected schema. |
Examples:
search
async
search(
query: str,
*,
media: str | Sequence[str] | None = None,
editeur: str | Sequence[str] | None = None,
genre: str | Sequence[str] | None = None,
parution_min: date | str | None = None,
parution_max: date | str | None = None,
) -> SearchResponse
Fetch the editions available for a movie or TV series title.
The result can be iterated directly (for item in results). Always check
truncated before treating the list as complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The title to search for, at least 2 characters. |
required |
media
|
str | Sequence[str] | None
|
Keep only these media types, for example
|
None
|
editeur
|
str | Sequence[str] | None
|
Keep only these publishers. |
None
|
genre
|
str | Sequence[str] | None
|
Keep only these DVDFr genres. |
None
|
parution_min
|
date | str | None
|
Earliest release date of the edition (a |
None
|
parution_max
|
date | str | None
|
Latest release date of the edition (same format). |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
A |
SearchResponse
|
DVD, Blu-ray, 4K...), |
SearchResponse
|
included), |
SearchResponse
|
|
SearchResponse
|
the list is incomplete). |
Raises:
| Type | Description |
|---|---|
InvalidQueryError
|
The query is too short or not a string, or a date is malformed (no request is sent). |
BadRequestError
|
The API rejected the request (HTTP 400). |
RateLimitError
|
Too many requests, after retries (see |
ServerError
|
The API or DVDFr failed (HTTP 5xx), after retries. |
NetworkError
|
The request could not be completed, after retries. |
InvalidResponseError
|
The response does not match the expected schema. |
Examples: