Skip to content

Exceptions

exceptions

imdbinfo exception hierarchy

ImdbinfoError ├── HTTPError — any non-200 HTTP response (status_code, url, response_text) │ └── WAFError — HTTP 202 from AWS WAF enforcement ├── GraphQLError — non-200 or {"errors": …} from the GraphQL endpoint └── ParseError — NEXT_DATA script not found in HTML response

ImdbinfoError

Bases: Exception

Base class for all imdbinfo exceptions.

HTTPError

Bases: ImdbinfoError

Raised when the IMDb HTML endpoint returns a non-200 status code.

Attributes:

Name Type Description
status_code int

The HTTP status code returned by the server.

url str

The full URL that was requested.

response_text str

The first 500 characters of the response body (may be empty).

WAFError

Bases: HTTPError

Raised when AWS WAF returns HTTP 202, blocking the request.

This is a subclass of :class:HTTPError so callers that catch HTTPError will also catch WAFError. Callers that want to handle WAF enforcement specifically (e.g. to rotate proxies or back off) can catch WAFError directly.

Attributes:

Name Type Description
status_code int

Always 202 for WAF-blocked responses.

url str

The full URL that was blocked.

response_text str

The first 500 characters of the WAF challenge response body.

GraphQLError

Bases: ImdbinfoError

Raised when the IMDb GraphQL API returns a non-200 status or an {"errors": […]} payload.

Attributes:

Name Type Description
url str

The GraphQL endpoint URL.

query_term str

The search term / entity ID used in the query.

status_code Optional[int]

HTTP status code when the failure is transport-level; None when the response was 200 but contained GraphQL errors.

errors List[Dict[str, Any]]

Parsed GraphQL error objects from the response body (empty list for transport-level failures).

response_text str

First 500 characters of the raw response body.

ParseError

Bases: ImdbinfoError

Raised when the expected __NEXT_DATA__ JSON script tag is absent from the IMDb HTML response.

Attributes:

Name Type Description
url str

The URL whose response could not be parsed.