Skip to content

Comicvine

ComicvineResource

Bases: Enum

Enum class for Comicvine Resources.

ATTRIBUTE DESCRIPTION
ISSUE

CHARACTER

PUBLISHER

CONCEPT

LOCATION

ORIGIN

POWER

CREATOR

STORY_ARC

VOLUME

ITEM

TEAM

Attributes

resource_id: int property

Start of id used by Comicvine to create unique ids.

search_resource: str property

Resource string for filtering searches.

search_response: type[T] property

Response type for resource when using a search endpoint.

Comicvine(api_key: str, cache: SQLiteCache | None, base_url: str = 'https://comicvine.gamespot.com/api', user_agent: str | None = None, timeout: float = 30, limiter: Limiter = Limiter(RATELIMIT_BUCKET))

Class with functionality to request Comicvine API endpoints.

PARAMETER DESCRIPTION
api_key

User's API key to access the Comicvine API.

TYPE: str

cache

Cache object to store and retrieve responses.

TYPE: SQLiteCache | None

base_url

Root URL of the Comicvine API.

TYPE: str DEFAULT: 'https://comicvine.gamespot.com/api'

user_agent

Value sent in the User-Agent request header.

TYPE: str | None DEFAULT: None

timeout

Number of seconds to wait for a server response before timing out.

TYPE: float DEFAULT: 30

limiter

Set a custom limiter, used for testing.

TYPE: Limiter DEFAULT: Limiter(RATELIMIT_BUCKET)

Functions

get_character(character_id: int) -> Character

Request a Character using its id.

PARAMETER DESCRIPTION
character_id

The Character id.

TYPE: int

RETURNS DESCRIPTION
Character

A Character object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_concept(concept_id: int) -> Concept

Request a Concept using its id.

PARAMETER DESCRIPTION
concept_id

The Concept id.

TYPE: int

RETURNS DESCRIPTION
Concept

A Concept object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_creator(creator_id: int) -> Creator

Request a Creator using its id.

PARAMETER DESCRIPTION
creator_id

The Creator id.

TYPE: int

RETURNS DESCRIPTION
Creator

A Creator object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_issue(issue_id: int) -> Issue

Request an Issue using its id.

PARAMETER DESCRIPTION
issue_id

The Issue id.

TYPE: int

RETURNS DESCRIPTION
Issue

A Issue object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_item(item_id: int) -> Item

Request an Item using its id.

PARAMETER DESCRIPTION
item_id

The Item id.

TYPE: int

RETURNS DESCRIPTION
Item

An Item object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_location(location_id: int) -> Location

Request a Location using its id.

PARAMETER DESCRIPTION
location_id

The Location id.

TYPE: int

RETURNS DESCRIPTION
Location

A Location object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_origin(origin_id: int) -> Origin

Request an Origin using its id.

PARAMETER DESCRIPTION
origin_id

The Origin id.

TYPE: int

RETURNS DESCRIPTION
Origin

An Origin object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_power(power_id: int) -> Power

Request a Power using its id.

PARAMETER DESCRIPTION
power_id

The Power id.

TYPE: int

RETURNS DESCRIPTION
Power

A Power object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_publisher(publisher_id: int) -> Publisher

Request a Publisher using its id.

PARAMETER DESCRIPTION
publisher_id

The Publisher id.

TYPE: int

RETURNS DESCRIPTION
Publisher

A Publisher object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_story_arc(story_arc_id: int) -> StoryArc

Request a Story Arc using its id.

PARAMETER DESCRIPTION
story_arc_id

The StoryArc id.

TYPE: int

RETURNS DESCRIPTION
StoryArc

A StoryArc object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_team(team_id: int) -> Team

Request a Team using its id.

PARAMETER DESCRIPTION
team_id

The Team id.

TYPE: int

RETURNS DESCRIPTION
Team

A Team object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

get_volume(volume_id: int) -> Volume

Request a Volume using its id.

PARAMETER DESCRIPTION
volume_id

The Volume id.

TYPE: int

RETURNS DESCRIPTION
Volume

A Volume object or None if not found.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_characters(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicCharacter]

Request a list of Characters.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicCharacter]

A list of Character objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_concepts(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicConcept]

Request a list of Concepts.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicConcept]

A list of Concept objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_creators(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicCreator]

Request a list of Creators.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicCreator]

A list of Creator objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_issues(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicIssue]

Request a list of Issues.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicIssue]

A list of Issue objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_items(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicItem]

Request a list of Items.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicItem]

A list of Item objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_locations(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicLocation]

Request a list of Locations.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicLocation]

A list of Location objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_origins(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicOrigin]

Request a list of Origins.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicOrigin]

A list of Origin objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_powers(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicPower]

Request a list of Powers.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicPower]

A list of Power objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_publishers(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicPublisher]

Request a list of Publishers.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicPublisher]

A list of Publisher objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_story_arcs(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicStoryArc]

Request a list of Story Arcs.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicStoryArc]

A list of StoryArc objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_teams(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicTeam]

Request a list of Teams.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicTeam]

A list of Team objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

list_volumes(params: dict[str, Any] | None = None, max_results: int = 500) -> list[BasicVolume]

Request a list of Volumes.

PARAMETER DESCRIPTION
params

Parameters to add to the request.

TYPE: dict[str, Any] | None DEFAULT: None

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicVolume]

A list of Volume objects.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.

search(resource: ComicvineResource, query: str, max_results: int = 500) -> list[BasicPublisher] | list[BasicVolume] | list[BasicIssue] | list[BasicStoryArc] | list[BasicCreator] | list[BasicCharacter] | list[BasicTeam] | list[BasicLocation] | list[BasicConcept] | list[BasicPower] | list[BasicOrigin] | list[BasicItem]

Request a list of search results filtered by provided resource.

PARAMETER DESCRIPTION
resource

Filter which type of resource to return.

TYPE: ComicvineResource

query

Search query string.

TYPE: str

max_results

Limits the amount of results looked up and returned.

TYPE: int DEFAULT: 500

RETURNS DESCRIPTION
list[BasicPublisher] | list[BasicVolume] | list[BasicIssue] | list[BasicStoryArc] | list[BasicCreator] | list[BasicCharacter] | list[BasicTeam] | list[BasicLocation] | list[BasicConcept] | list[BasicPower] | list[BasicOrigin] | list[BasicItem]

A list of results, mapped to the given resource.

RAISES DESCRIPTION
ServiceError

If the API response is invalid or validation fails.

AuthenticationError

If credentials are invalid.

RateLimitError

If the API rate limit is exceeded.