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 property

Start of id used by Comicvine to create unique ids.

search_resource property

Resource string for filtering searches.

search_response property

Response type for a resource when using a search endpoint.

Comicvine

Class with functionality to request Comicvine API endpoints.

PARAMETER DESCRIPTION
api_key

User's API key to access the Comicvine API.

TYPE: str

base_url

Root URL of the Comicvine API.

TYPE: str | None DEFAULT: None

user_agent

Value sent in the User-Agent request header.

TYPE: str | None DEFAULT: None

timeout

Set how long requests will wait for a response (in seconds).

TYPE: float DEFAULT: 20

cache_path

Path to the SQLite cache file. If not provided, a default path will be used under ~/.cache/simyan/cache.sqlite

TYPE: Path | None DEFAULT: None

cache_expiry

Duration for which cached responses are valid. Response cache-headers take precedence.

TYPE: timedelta DEFAULT: timedelta(days=14)

ratelimit_path

Path to the SQLite ratelimit file. If not provided, a default path will be used under ~/.cache/simyan/ratelimits.sqlite

TYPE: Path | None DEFAULT: None

Source code in simyan/comicvine.py
Python
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
def __init__(
    self,
    api_key: str,
    base_url: str | None = None,
    user_agent: str | None = None,
    timeout: float = 20,
    cache_path: Path | None = None,
    cache_expiry: timedelta = timedelta(days=14),
    ratelimit_path: Path | None = None,
):
    self._base_url = base_url or "https://comicvine.gamespot.com/api"
    self._session = CachedLimiterSession(
        backend=SQLiteCache(
            db_path=cache_path or (get_cache_root() / "cache.sqlite"), serializer="json"
        ),
        expire_after=cache_expiry,
        cache_control=cache_expiry != NEVER_EXPIRE,
        ignored_parameters=["api_key"],
        per_second=1,
        per_hour=200,
        max_delay=timeout * 2,
        bucket_class=SQLiteBucket,
        bucket_kwargs={"path": ratelimit_path or (get_cache_root() / "ratelimits.sqlite")},
        per_host=False,
        bucket_name="comicvine",
    )
    self._session.headers.update(
        {
            "Accept": "application/json",
            "User-Agent": user_agent
            or f"Simyan/{__version__} ({platform.system()}: {platform.release()}; Python v{platform.python_version()})",  # noqa: E501
        }
    )
    self._session.params.update({"api_key": api_key, "format": "json"})
    self._timeout = timeout

Methods:

get_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.

Source code in simyan/comicvine.py
Python
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
def get_character(self, character_id: int) -> Character:
    """Request a Character using its id.

    Args:
        character_id: The Character id.

    Returns:
        A Character object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/character/{ComicvineResource.CHARACTER.resource_id}-{character_id}"
        )
        return TypeAdapter(Character).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
def get_concept(self, concept_id: int) -> Concept:
    """Request a Concept using its id.

    Args:
        concept_id: The Concept id.

    Returns:
        A Concept object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/concept/{ComicvineResource.CONCEPT.resource_id}-{concept_id}"
        )
        return TypeAdapter(Concept).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
def get_creator(self, creator_id: int) -> Creator:
    """Request a Creator using its id.

    Args:
        creator_id: The Creator id.

    Returns:
        A Creator object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/person/{ComicvineResource.CREATOR.resource_id}-{creator_id}"
        )
        return TypeAdapter(Creator).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
def get_issue(self, issue_id: int) -> Issue:
    """Request an Issue using its id.

    Args:
        issue_id: The Issue id.

    Returns:
        A Issue object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/issue/{ComicvineResource.ISSUE.resource_id}-{issue_id}"
        )
        return TypeAdapter(Issue).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
def get_item(self, item_id: int) -> Item:
    """Request an Item using its id.

    Args:
        item_id: The Item id.

    Returns:
        An Item object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/object/{ComicvineResource.ITEM.resource_id}-{item_id}"
        )
        return TypeAdapter(Item).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
def get_location(self, location_id: int) -> Location:
    """Request a Location using its id.

    Args:
        location_id: The Location id.

    Returns:
        A Location object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/location/{ComicvineResource.LOCATION.resource_id}-{location_id}"
        )
        return TypeAdapter(Location).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
def get_origin(self, origin_id: int) -> Origin:
    """Request an Origin using its id.

    Args:
        origin_id: The Origin id.

    Returns:
        An Origin object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/origin/{ComicvineResource.ORIGIN.resource_id}-{origin_id}"
        )
        return TypeAdapter(Origin).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
def get_power(self, power_id: int) -> Power:
    """Request a Power using its id.

    Args:
        power_id: The Power id.

    Returns:
        A Power object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/power/{ComicvineResource.POWER.resource_id}-{power_id}"
        )
        return TypeAdapter(Power).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
def get_publisher(self, publisher_id: int) -> Publisher:
    """Request a Publisher using its id.

    Args:
        publisher_id: The Publisher id.

    Returns:
        A Publisher object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/publisher/{ComicvineResource.PUBLISHER.resource_id}-{publisher_id}"
        )
        return TypeAdapter(Publisher).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_story_arc

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.

Source code in simyan/comicvine.py
Python
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
def get_story_arc(self, story_arc_id: int) -> StoryArc:
    """Request a Story Arc using its id.

    Args:
        story_arc_id: The StoryArc id.

    Returns:
        A StoryArc object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/story_arc/{ComicvineResource.STORY_ARC.resource_id}-{story_arc_id}"
        )
        return TypeAdapter(StoryArc).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
def get_team(self, team_id: int) -> Team:
    """Request a Team using its id.

    Args:
        team_id: The Team id.

    Returns:
        A Team object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/team/{ComicvineResource.TEAM.resource_id}-{team_id}"
        )
        return TypeAdapter(Team).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

get_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.

Source code in simyan/comicvine.py
Python
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
def get_volume(self, volume_id: int) -> Volume:
    """Request a Volume using its id.

    Args:
        volume_id: The Volume id.

    Returns:
        A Volume object or None if not found.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        result = self._fetch_item(
            endpoint=f"/volume/{ComicvineResource.VOLUME.resource_id}-{volume_id}"
        )
        return TypeAdapter(Volume).validate_python(result)
    except ValidationError as err:
        raise ServiceError(err) from err

list_characters

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 number 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.

Source code in simyan/comicvine.py
Python
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
def list_characters(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicCharacter]:
    """Request a list of Characters.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Character objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/characters", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicCharacter]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_concepts

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 number 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.

Source code in simyan/comicvine.py
Python
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
def list_concepts(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicConcept]:
    """Request a list of Concepts.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Concept objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/concepts", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicConcept]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_creators

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 number 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.

Source code in simyan/comicvine.py
Python
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
def list_creators(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicCreator]:
    """Request a list of Creators.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Creator objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/people", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicCreator]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_issues

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 number 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.

Source code in simyan/comicvine.py
Python
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
def list_issues(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicIssue]:
    """Request a list of Issues.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Issue objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/issues", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicIssue]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_items

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 number 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.

Source code in simyan/comicvine.py
Python
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
def list_items(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicItem]:
    """Request a list of Items.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Item objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/objects", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicItem]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_locations

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 number 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.

Source code in simyan/comicvine.py
Python
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
def list_locations(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicLocation]:
    """Request a list of Locations.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Location objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/locations", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicLocation]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_origins

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 number 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.

Source code in simyan/comicvine.py
Python
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
def list_origins(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicOrigin]:
    """Request a list of Origins.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Origin objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/origins", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicOrigin]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_powers

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 number 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.

Source code in simyan/comicvine.py
Python
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
def list_powers(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicPower]:
    """Request a list of Powers.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Power objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/powers", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicPower]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_publishers

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 number 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.

Source code in simyan/comicvine.py
Python
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
def list_publishers(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicPublisher]:
    """Request a list of Publishers.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Publisher objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/publishers", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicPublisher]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_story_arcs

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 number 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.

Source code in simyan/comicvine.py
Python
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
def list_story_arcs(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicStoryArc]:
    """Request a list of Story Arcs.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of StoryArc objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/story_arcs", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicStoryArc]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_teams

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 number 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.

Source code in simyan/comicvine.py
Python
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
def list_teams(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicTeam]:
    """Request a list of Teams.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Team objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/teams", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicTeam]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

list_volumes

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 number 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.

Source code in simyan/comicvine.py
Python
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
def list_volumes(
    self, params: dict[str, Any] | None = None, max_results: int = 500
) -> list[BasicVolume]:
    """Request a list of Volumes.

    Args:
        params: Parameters to add to the request.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of Volume objects.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_offset_list(
            endpoint="/volumes", params=params, max_results=max_results
        )
        return TypeAdapter(list[BasicVolume]).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err

search

Request a list of search results filtered by the provided resource.

PARAMETER DESCRIPTION
resource

Filter which type of resource to return.

TYPE: ComicvineResource

query

Search query string.

TYPE: str

max_results

Limits the number 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.

Source code in simyan/comicvine.py
Python
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
def search(
    self, 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 the provided resource.

    Args:
        resource: Filter which type of resource to return.
        query: Search query string.
        max_results: Limits the number of results looked up and returned.

    Returns:
        A list of results, mapped to the given resource.

    Raises:
        ServiceError: If the API response is invalid or validation fails.
        AuthenticationError: If credentials are invalid.
        RateLimitError: If the API rate limit is exceeded.
    """
    try:
        results = self._fetch_paged_list(
            endpoint="/search",
            params={"query": query, "resources": resource.search_resource},
            max_results=max_results,
        )
        return TypeAdapter(resource.search_response).validate_python(results)
    except ValidationError as err:
        raise ServiceError(err) from err