Skip to content

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.

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.

DEFAULT_TIMEOUT
max_retries int

Extra attempts after a network error, a 429 or a 502/503/504. Use 0 to disable retries; otherwise one call sends at most max_retries + 1 requests. Waits honor the Retry-After header when present (capped at 30 s), otherwise they grow exponentially. Defaults to DEFAULT_MAX_RETRIES.

DEFAULT_MAX_RETRIES
client Client | None

An existing httpx.Client to use instead of creating one. In that case base_url, timeout and the default headers are ignored (your client defines them), and closing it is up to you.

None

Raises:

Type Description
ValueError

If max_retries is negative.

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

(barcode, as PNG bytes).

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 retry_after).

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:

>>> product = client.get_product("3333290016961")
>>> product.title
'Breaking Bad - Intégrale de la série + El Camino : un film "Breaking Bad"'

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 ["Blu-ray", "4K Ultra HD"]. A single string is accepted too. Values are matched by DVDFr.

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 date or a "YYYY-MM-DD" string).

None
parution_max date | str | None

Latest release date of the edition (same format).

None

Returns:

Type Description
SearchResponse

A SearchResponse with results (one SearchItem per edition:

SearchResponse

DVD, Blu-ray, 4K...), total (editions returned, other editions

SearchResponse

included), dvdfr_total (products announced by DVDFr) and

SearchResponse

truncated (True if not all DVDFr pages could be crawled, so the

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 retry_after).

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:

>>> results = client.search("Alien", media="Blu-ray", parution_min="2015-01-01")
>>> for item in results:
...     print(item.isbn, item.media, item.title)

close

close() -> None

Close the underlying connection.

Does nothing if you passed your own httpx.Client with client=: closing it is then up to you. Prefer the context manager, which calls this method for you:

>>> with Client() as client:
...     product = client.get_product("3333290016961")

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.

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.

DEFAULT_TIMEOUT
max_retries int

Extra attempts after a network error, a 429 or a 502/503/504. Use 0 to disable retries; otherwise one call sends at most max_retries + 1 requests. Waits honor the Retry-After header when present (capped at 30 s), otherwise they grow exponentially. Defaults to DEFAULT_MAX_RETRIES.

DEFAULT_MAX_RETRIES
client AsyncClient | None

An existing httpx.AsyncClient to use instead of creating one. In that case base_url, timeout and the default headers are ignored (your client defines them), and closing it is up to you.

None

Raises:

Type Description
ValueError

If max_retries is negative.

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

(barcode, as PNG bytes).

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 retry_after).

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:

>>> product = await client.get_product("3333290016961")
>>> print(product.title)

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 ["Blu-ray", "4K Ultra HD"]. A single string is accepted too.

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 date or a "YYYY-MM-DD" string).

None
parution_max date | str | None

Latest release date of the edition (same format).

None

Returns:

Type Description
SearchResponse

A SearchResponse with results (one SearchItem per edition:

SearchResponse

DVD, Blu-ray, 4K...), total (editions returned, other editions

SearchResponse

included), dvdfr_total (products announced by DVDFr) and

SearchResponse

truncated (True if not all DVDFr pages could be crawled, so

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 retry_after).

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:

>>> results = await client.search("Alien", media="Blu-ray", parution_min="2015-01-01")
>>> for item in results:
...     print(item.isbn, item.media, item.title)

aclose async

aclose() -> None

Close the underlying connection.

Does nothing if you passed your own httpx.AsyncClient with client=: closing it is then up to you. Prefer the async context manager, which calls this method for you:

>>> async with AsyncClient() as client:
...     product = await client.get_product("3333290016961")