esak package

Submodules

esak.character module

Character module.

This module provides the following classes:

  • Character

  • CharacterSchema

  • CharactersList

class esak.character.Character(**kwargs)

Bases: object

The Character object contains information for characters.

Parameters

**kwargs – The keyword arguments used for setting character data from Marvel.

id

The unique ID of the character resource.

Type

int

name

The name of the character.

Type

str

description

A short bio or description of the character.

Type

str

modified

The date the resource was most recently modified.

Type

datetime

resource_uri

The canonical URL identifier for this resource.

Type

str

urls

A set of public web site URLs for the resource.

Type

list(Urls)

thumbnail

The representative image for this character.

Type

str

comics

A resource list containing comics which feature this character.

Type

list(Comic)

stories

A resource list of stories in which this character appears.

Type

list(Summary)

events

A resource list of events in which this character appears.

Type

list(Summary)

series

A resource list of series in which this character appears.

Type

list(Summary)

class esak.character.CharacterSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Character API.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kwargs)

Make the character object.

Parameters

data – Data from a Marvel API response.

Returns

A Character object

Return type

Character

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean the data from Marvel.

Parameters

data – Data from a Marvel api response.

Returns

Marvel response.

Return type

dict

class esak.character.CharactersList(response)

Bases: object

The CharactersList object contains a list of Character objects.

esak.comic module

Comic module.

This module provides the following classes:

  • Comic

  • ComicSchema

  • ComicsList

class esak.comic.Comic(**kwargs)

Bases: object

The Comic object contains information for a comic.

Parameters

**kwargs – The keyword arguments used for setting data from Marvel.

id

The unique ID of the comic resource.

Type

int

digital_id

The ID of the digital comic representation of this comic. Will be 0 if the comic is not available digitally.

Type

int

title

The canonical title of the comic.

Type

str

issue_number

The number of the issue in the series (will generally be 0 for collection formats).

Type

int

variant_description

If the issue is a variant (e.g. an alternate cover, second printing, or director’s cut), a text description of the variant.

Type

str

description

The preferred description of the comic.

Type

str, optional

modified

The date the resource was most recently modified.

Type

datetime

isbn

The ISBN for the comic (generally only populated for collection formats).

Type

str

upc

The UPC barcode number for the comic (generally only populated for periodical formats).

Type

str

diamond_code

The Diamond code for the comic.

Type

str

ean

The EAN barcode for the comic.

Type

str

issn

The ISSN barcode for the comic.

Type

str

format

The publication format of the comic e.g. comic, hardcover, trade paperback.

Type

str

page_count

The number of story pages in the comic.

Type

int

text_objects

A set of descriptive text blurbs for the comic.

Type

list(TextObject)

resource_uri

The canonical URL identifier for this resource.

Type

url

urls

A set of public web site URLs for the resource.

Type

list(Urls)

series

A summary representation of the series to which this comic belongs.

Type

list(Series)

variants

A list of variant issues for this comic (includes the “original” issue if the current issue is a variant).

Type

list(Summary)

collections

A list of collections which include this comic (will generally be empty if the comic’s format is a collection).

Type

list(Summary)

collected_issues

A list of issues collected in this comic (will generally be empty for periodical formats such as “comic” or “magazine”).

Type

list(Summary)

dates

A list of key dates for this comic.

Type

list(Dates)

prices

A list of prices for this comic.

Type

list(Price)

thumbnail

The representative image for this comic.

Type

url

images

A list of promotional images associated with this comic.

Type

list(url)

creators

A resource list containing the creators associated with this comic.

Type

list(Summary)

characters

A resource list containing the characters which appear in this comic.

Type

list(Summary)

stories

A resource list containing the stories which appear in this comic.

Type

list(Summary)

events

A resource list containing the events in which this comic appears.

Type

list(Summary)

class esak.comic.ComicSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Comic API.

Changed in version 1.3.0:

  • Added thumbnail and text_objects fields.

  • Unknowns fields will now be excluded.

class Meta

Bases: object

Any unknown fields will be excluded.

unknown = 'exclude'
make(data, **kwargs)

Make the Comic object.

Parameters

data – Data from a Marvel API response.

Returns

A Comic object

Return type

Comic

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean the data from Marvel.

Parameters

data – Data from a Marvel api response.

Returns

Marvel response.

Return type

dict

class esak.comic.ComicsList(response)

Bases: object

The ComicsList object contains a list of Comic objects.

esak.creator module

Creator module.

This module provides the following classes:

  • Creator

  • CreatorSchema

class esak.creator.Creator(**kwargs)

Bases: object

The Creator object contains information for creators.

Parameters

**kwargs – The keyword arguments used for setting character data from Marvel.

id

The unique ID of the creator resource.

Type

int

first_name

The first name of the creator.

Type

str

middle_name

The middle name of the creator.

Type

str

last_name

The last name of the creator.

Type

str

suffix

The suffix or honorific for the creator.

Type

str

full_name

The full name of the creator (a space-separated concatenation of the above four fields).

Type

str

modified

The date the resource was most recently modified.

Type

datetime

resource_uri

The canonical URL identifier for this resource.

Type

url

thumbnail

The representative image for this creator.

Type

url

series

A resource list containing the series which feature work by this creator.

Type

list(Summary)

stories

A resource list containing the stories which feature work by this creator.

Type

list(Summary)

events

A resource list containing the events which feature work by this creator.

Type

list(Summary)

comics

A resource list containing the comics which feature work by this creator.

Type

list(Summary)

class esak.creator.CreatorsList(response)

Bases: object

The CreatorsList object contains a list of Creator objects.

class esak.creator.CreatorsSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Creator API.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kwargs)

Make the Creator object.

Parameters

data – Data from a Marvel API response.

Returns

A Creator object

Return type

Creator

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean the data from Marvel.

Parameters

data – Data from a Marvel api response.

Returns

Marvel response.

Return type

dict

esak.dates module

Dates module.

This module provides the following classes:

  • Dates

  • DatesSchema

class esak.dates.Dates(on_sale=None, foc=None, unlimited=None, **kwargs)

Bases: object

The Dates object contains common dates.

Parameters
  • on_sale (date) – The date the comic went on sale.

  • foc (date) – The final order cutoff date.

  • unlimited (date) – The date it was release on Marvel Unlimited.

  • **kwargs – The keyword arguments used for setting any other date from Marvel.

on_sale

The date the comic went on sale.

Type

date

foc

The final order cutoff date.

Type

date

unlimited

The date it was release on Marvel Unlimited.

Type

date

class esak.dates.DatesSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Dates.

class Meta

Bases: object

Any unknown fields will be included.

dateformat = '%Y-%m-%dT%H:%M:%S%z'
unknown = 'include'
make(data, **kwargs)

Make the dates object.

Parameters

data – Data from a Marvel API response.

Returns

A Date object

Return type

Dates

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean up response data.

esak.event module

Events module.

This module provides the following classes:

  • Event

  • EventSchema

  • EventsList

class esak.event.EventSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Event API.

class Meta

Bases: object

Any unknown fields will be included.

dateformat = '%Y-%m-%d %H:%M:%S'
unknown = 'include'
make(data, **kargs)

Make the events object.

Parameters

data – Data from a Marvel API response.

Returns

A Event object

Return type

Event

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean the data from Marvel.

Parameters

data – Data from a Marvel api response.

Returns

Marvel response.

Return type

dict

class esak.event.Events(**kwargs)

Bases: object

The Event object contains information for events.

Parameters

**kwargs – The keyword arguments used for setting data from Marvel.

id

The unique ID of the event resource.

Type

int

title

The title of the event.

Type

str

description

A description of the event.

Type

str

resource_uri

The canonical URL identifier for this resource.

Type

url

modified

The date the resource was most recently modified.

Type

datetime

start

The date of publication of the first issue in this event.

Type

date

end

The date of publication of the last issue in this event.

Type

date

thumbnail

The representative image for this event.

Type

url

comics

A resource list containing the comics in this event.

Type

list(Summary)

stories

A resource list containing the stories in this event.

Type

list(Summary)

series

A resource list containing the series in this event.

Type

list(Summary)

characters

A resource list containing the characters which appear in this event.

Type

list(Summary)

creators

A resource list containing creators whose work appears in this event.

Type

list(Summary)

next

A summary representation of the event which follows this event.

Type

list(Summary)

previous

A summary representation of the event which preceded this event.

Type

list(Summary)

class esak.event.EventsList(response)

Bases: object

The EventsList object contains a list of Events objects.

esak.exceptions module

Exceptions module.

This module provides the following classes:

  • ApiError

  • AuthenticationError

  • CacheError

exception esak.exceptions.ApiError(*args, **kwargs)

Bases: Exception

Class for any api errors.

exception esak.exceptions.AuthenticationError(*args, **kwargs)

Bases: ApiError

Class for any authentication errors.

exception esak.exceptions.CacheError(*args, **kwargs)

Bases: ApiError

Class for any database cache errors.

esak.prices module

Prices module.

This module provides the following classes:

  • Prices

  • PricesSchema

class esak.prices.PriceSchemas(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Prices.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kwargs)

Make the prices object.

Parameters

data – Data from a Marvel API response.

Returns

A Prices object

Return type

Prices

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean up response data.

class esak.prices.Prices(print=None, digital=None, **kwargs)

Bases: object

The Prices object contains price information.

Parameters
  • print (decimal) – The price of print comic.

  • digital (decimal) – The price of digital comic.

  • **kwargs – The keyword arguments used for setting any other price from Marvel.

print

The price of print comic.

Type

decimal

digital

The price of digital comic.

Type

decimal

esak.series module

Series module.

This module provides the following classes:

  • Series

  • SeriesSchema

class esak.series.Series(**kwargs)

Bases: object

The Series object contains information for a series.

Parameters

**kwargs – The keyword arguments used for setting data from Marvel.

id

The unique ID of the series resource.

Type

int

title

The canonical title of the series.

Type

str

description

A description of the series.

Type

str

resource_uri

The canonical URL identifier for this resource.

Type

url

start_year

The first year of publication for the series.

Type

int

end_year

The last year of publication for the series (conventionally, 2099 for ongoing series).

Type

int

rating

The age-appropriateness rating for the series.

Type

str

modified

The date the resource was most recently modified.

Type

datetime

thumbnail

The representative image for this series.

Type

url

comics

A resource list containing comics in this series.

Type

list(Summary)

stories

A resource list containing stories which occur in comics in this series.

Type

list(Summary)

events

A resource list containing events which take place in comics in this series.

Type

list(Summary)

characters

A resource list containing characters which appear in comics in this series.

Type

list(Summary)

creators

A resource list of creators whose work appears in comics in this series.

Type

list(Summary)

next

A summary representation of the series which follows this series.

Type

list(Summary)

previous

A summary representation of the series which preceded this series.

Type

list(Summary)

class esak.series.SeriesList(response)

Bases: object

The SeriesList object contains a list of Series objects.

class esak.series.SeriesSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Comic API.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kwargs)

Make the Series object.

Parameters

data – Data from a Marvel API response.

Returns

A Series object

Return type

Series

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean the data from Marvel.

Parameters

data – Data from a Marvel api response.

Returns

Marvel response.

Return type

dict

esak.session module

Session module.

This module provides the following classes:

  • Session

class esak.session.Session(public_key: str, private_key: str, cache: Optional[SqliteCache] = None)

Bases: object

Session to request api endpoints.

Parameters
  • public_key (str) – The public_key for authentication with Marvel

  • private_key (str) – The private_key used for authentication with Marvel

  • SqliteCache (optional, SqliteCache) – SqliteCache to use

Returns

A Session object to make api calls to Marvel.

Return type

Session

character(_id: int) Character

Request data for a character based on it’s _id.

Parameters

_id (int) – The character id.

Returns

A Character object.

Return type

Character

Raises

ApiError – If requested information is not valid.

character_comics(_id: int, params: Optional[Dict[str, Any]] = None) ComicsList

Request a list of comics for a character.

Parameters
  • _id (int) – The character id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Comic objects.

Return type

ComicsList

character_events(_id: int, params: Optional[Dict[str, Any]] = None) EventsList

Request a list of events for a character.

Parameters
  • _id (int) – The character id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Event objects.

Return type

EventsList

character_series(_id: int, params: Optional[Dict[str, Any]] = None) SeriesList

Request a list of series for a character.

Parameters
  • _id (int) – The character id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Series objects.

Return type

SeriesList

character_stories(_id: int, params: Optional[Dict[str, Any]] = None) StoriesList

Request a list of stories for a character.

Parameters
  • _id (int) – The character id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Stories objects.

Return type

StoriesList

characters_list(params: Optional[Dict[str, Any]] = None) CharactersList

Request a list of characters.

Parameters
  • _id (int) – The character id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Character objects.

Return type

CharactersList

comic(_id: int) Comic

Request data for a comic based on it’s _id.

Parameters

_id (int) – The comic id.

Returns

A Comic object

Return type

Comic

Raises

ApiError – If requested information is not valid.

comic_characters(_id: int, params: Optional[Dict[str, Any]] = None) CharactersList

Request a list of characters from a comic.

Parameters
  • _id (int) – The comic id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Character objects.

Return type

CharactersList

comic_creators(_id: int, params: Optional[Dict[str, Any]] = None) CreatorsList

Request a list of creators from a comic.

Parameters
  • _id (int) – The comic id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Creator objects.

Return type

CreatorsList

comic_events(_id: int, params: Optional[Dict[str, Any]] = None) EventsList

Request a list of events from a comic.

Parameters
  • _id (int) – The comic id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Event objects.

Return type

EventsList

comic_stories(_id: int, params: Optional[Dict[str, Any]] = None) StoriesList

Request a list of stories from a comic.

Parameters
  • _id (int) – The comic id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Stories objects.

Return type

StoriesList

comics_list(params: Optional[Dict[str, Any]] = None) ComicsList

Request a list of comics.

Parameters

params (dict, optional) – Parameters to add to the request.

Returns

A list of Comic objects.

Return type

ComicsList

creator(_id: int) Creator

Request data for a creator based on it’s _id.

Parameters

_id (int) – The creator id.

Returns

Creator object

Return type

Creator

Raises

ApiError – If requested information is not valid.

creator_comics(_id: int, params: Optional[Dict[str, Any]] = None) ComicsList

Request a list of comics from a creator.

Parameters
  • _id (int) – The creator id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Comic objects.

Return type

ComicsList

creator_events(_id: int, params: Optional[Dict[str, Any]] = None) EventsList

Request a list of events from a creator.

Parameters
  • _id (int) – The creator id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Event objects.

Return type

EventsList

creator_series(_id: int, params: Optional[Dict[str, Any]] = None) SeriesList

Request a list of series by a creator.

Parameters
  • _id (int) – The creator id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Series objects.

Return type

SeriesList

creator_stories(_id: int, params: Optional[Dict[str, Any]] = None) StoriesList

Request a list of stories from a creator.

Parameters
  • _id (int) – The creator id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Stories objects.

Return type

StoriesList

creators_list(params: Optional[Dict[str, Any]] = None) CreatorsList

Request a list of creators.

Parameters
  • _id (int) – The creator id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Creator objects.

Return type

CreatorsList

event(_id: int) Events

Request data for an event based on it’s _id.

Parameters

_id (int) – The event id.

Returns

A Events object

Return type

Events

Raises

ApiError – If requested information is not valid.

event_characters(_id: int, params: Optional[Dict[str, Any]] = None) CharactersList

Request a list of characters from an event.

Parameters
  • _id (int) – The event id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Character objects.

Return type

CharactersList

event_comics(_id: int, params: Optional[Dict[str, Any]] = None) ComicsList

Request a list of comics for an event.

Parameters
  • _id (int) – The event id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Comic objects.

Return type

ComicsList

event_creators(_id: int, params: Optional[Dict[str, Any]] = None) CreatorsList

Request a list of creators from an event.

Parameters
  • _id (int) – The event id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Creator objects.

Return type

CreatorsList

event_series(_id: int, params: Optional[Dict[str, Any]] = None) SeriesList

Request a list of series for an event.

Parameters
  • _id (int) – The event id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Series objects.

Return type

SeriesList

event_stories(_id: int, params: Optional[Dict[str, Any]] = None) StoriesList

Request a list of stories for an event.

Parameters
  • _id (int) – The event id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Stories objects.

Return type

StoriesList

events_list(params: Optional[Dict[str, Any]] = None) EventsList

Request a list of events.

Parameters

params (dict, optional) – Parameters to add to the request.

Returns

A list of Event objects.

Return type

EventsList

series(_id: int) Series

Request data for a series based on it’s _id.

Parameters

_id (int) – The series id.

Returns

Series object

Return type

Series

Raises

ApiError – If requested information is not valid.

series_characters(_id: int, params: Optional[Dict[str, Any]] = None) CharactersList

Request a list of characters from a series.

Parameters
  • _id (int) – The series id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Character objects.

Return type

CharactersList

series_comics(_id: int, params: Optional[Dict[str, Any]] = None) ComicsList

Request a list of comics from a series.

Parameters
  • _id (int) – The series id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Comic objects.

Return type

ComicsList

series_creators(_id: int, params: Optional[Dict[str, Any]] = None) CreatorsList

Request a list of creators from a series.

Parameters
  • _id (int) – The series id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Creator objects.

Return type

CreatorsList

series_events(_id: int, params: Optional[Dict[str, Any]] = None) EventsList

Request a list of events from a series.

Parameters
  • _id (int) – The series id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Event objects.

Return type

EventsList

series_list(params: Optional[Dict[str, Any]] = None) SeriesList

Request a list of series.

Parameters

params (dict, optional) – Parameters to add to the request.

Returns

A list of Series objects.

Return type

SeriesList

series_stories(_id: int, params: Optional[Dict[str, Any]] = None) StoriesList

Request a list of stories from a series.

Parameters
  • _id (int) – The series id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Stories objects.

Return type

StoriesList

stories_list(params: Optional[Dict[str, Any]] = None) StoriesList

Request a list of stories.

Parameters

params (dict, optional) – Parameters to add to the request.

Returns

A list of Stories objects.

Return type

StoriesList

story(_id: int) Stories

Request data for a Story based on it’s _id.

Parameters

_id (int) – The story id.

Returns

A Stories object

Return type

Stories

Raises

ApiError – If requested information is not valid.

story_characters(_id: int, params: Optional[Dict[str, Any]] = None) CharactersList

Request a list of characters from a story.

Parameters
  • _id (int) – The story id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Character objects.

Return type

CharactersList

story_comics(_id: int, params: Optional[Dict[str, Any]] = None) ComicsList

Request a list of comics for a story.

Parameters
  • _id (int) – The story id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Comic objects.

Return type

ComicsList

story_creators(_id: int, params: Optional[Dict[str, Any]] = None) CreatorsList

Request a list of creators from a story.

Parameters
  • _id (int) – The story id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Creator objects.

Return type

CreatorsList

story_events(_id: int, params: Optional[Dict[str, Any]] = None) EventsList

Request a list of events for a story.

Parameters
  • _id (int) – The story id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Event objects.

Return type

EventsList

story_series(_id: int, params: Optional[Dict[str, Any]] = None) SeriesList

Request a list of series for a story.

Parameters
  • _id (int) – The story id.

  • params (dict, optional) – Parameters to add to the request.

Returns

A list of Series objects.

Return type

SeriesList

esak.sqlite_cache module

SQLite Cache module.

This module provides the following classes:

  • SqliteCache

class esak.sqlite_cache.SqliteCache(db_name: str = 'esak_cache.db', expire: Optional[int] = None)

Bases: object

The SqliteCache object to cache search results from Marvel.

Parameters
  • db_name (str) – Path and database name to use.

  • expire (int, optional) – The number of days to keep the cache results before they expire.

Returns

A SqliteCache Object.

Return type

SqliteCache

cleanup() None

Remove any expired data from the cache database.

get(key: str) Optional[Any]

Retrieve data from the cache database.

Parameters

key (str) – value to search for.

store(key: str, value: str) None

Save data to the cache database.

Parameters
  • key (str) – Item id.

  • value (str) – data to save.

esak.stories module

Stories module.

This module provides the following classes:

  • Stories

  • StoriesSchema

  • StoriesList

class esak.stories.Stories(**kwargs)

Bases: object

The Stories object contains information for stories.

Parameters

**kwargs – The keyword arguments used for setting stories data from Marvel.

id

The unique ID of the story resource.

Type

int

title

The story title.

Type

str

descriptions

A short description of the story.

Type

str

resource_uri

The canonical URL identifier for this resource.

Type

url

type

The story type e.g. interior story, cover, text story.

Type

str

modified

The date the resource was most recently modified.

Type

datetime

thumbnail

The representative image for this story.

Type

url

comics

A resource list containing comics in which this story takes place.

Type

list(Summary)

series

A resource list containing series in which this story appears.

Type

list(Summary)

events

A resource list of the events in which this story appears.

Type

list(Summary)

characters

A resource list of characters which appear in this story.

Type

list(Summary)

creators

A resource list of creators who worked on this story.

Type

list(Summary)

original_issue

A summary representation of the issue in which this story was originally published.

Type

list(Summary)

class esak.stories.StoriesList(response)

Bases: object

The StoriesList object contains a list of Stories objects.

class esak.stories.StoriesSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Stories API.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kargs)

Make the stories object.

Parameters

data – Data from a Marvel API response.

Returns

A Stories object

Return type

Stories

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean the data from Marvel.

Parameters

data – Data from a Marvel api response.

Returns

Marvel response.

Return type

dict

esak.summary module

Summary module.

This module provides the following classes:

  • Summary

  • SummarySchema

class esak.summary.Summary(id=None, name=None, resource_uri=None, type=None, role=None, **kwargs)

Bases: object

The Summary object contains basic information.

Parameters

**kwargs – The keyword arguments used for setting summary data from Marvel.

id

The unique ID of the summary resource.

Type

int

name

The name of the summary.

Type

str

resource_uri

The path to the individual summary resource.

Type

url

type

The summary type.

Type

str

role

The role of the summary in the parent entity.

Type

str

class esak.summary.SummarySchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Summary.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kwargs)

Make the Summary object.

Parameters

data – Data from a Marvel API response.

Returns

A Summary object

Return type

Summary

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Extract the summary id.

esak.text_object module

TextObject module.

This module provides the following classes:

  • TextObject

  • TextObjectSchema

class esak.text_object.TextObject(**kwargs)

Bases: object

The TextObject object contains basic information.

Parameters

**kwargs – The keyword arguments used for setting textobject data from Marvel.

type

The canonical type of the text object (e.g. solicit text, preview text, etc.).

Type

str

language

The IETF language tag denoting the language the text object is written in.

Type

str

text

The text.

Type

str

class esak.text_object.TextObjectSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the TextObject.

make(data, **kwargs)

Make the TextObject object.

Parameters

data – Data from a Marvel API response.

Returns

A TextObject object

Return type

TextObject

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>

esak.urls module

Urls module.

This module provides the following classes:

  • Urls

  • UrlsSchema

class esak.urls.Urls(digital_purchase_date=None, foc_date=None, onsale_date=None, unlimited_date=None, wiki=None, detail=None, **kwargs)

Bases: object

The Urls object contains commonly used urls.

Parameters
  • digital_purchase_date – The url for the digital_purchase_date

  • foc_date – The url for the final order cutoff date.

  • onsale_date – The url for the on sale date.

  • unlimited_date – The url for the Marvel Unlimited date.

  • wiki – The url for the wiki entry.

  • detail – The url for detail information.

  • **kwargs – The keyword arguments used for setting any other url from Marvel.

digital_purchase_date

The url for the digital_purchase_date

Type

Url

foc_date

The url for the final order cutoff date.

Type

Url

onsale_date

The url for the on sale date.

Type

Url

unlimited_date

The url for the Marvel Unlimited date.

Type

Url

wiki

The url for the wiki entry.

Type

Url

detail

The url for detail information.

Type

Url

class esak.urls.UrlsSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)

Bases: Schema

Schema for the Urls.

class Meta

Bases: object

Any unknown fields will be included.

unknown = 'include'
make(data, **kwargs)

Make the urls object.

Parameters

data – Data from a Marvel api response.

Returns

A Urls object.

Return type

Urls

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
process_input(data, **kwargs)

Clean up response data.

esak.utils module

Utils module.

This module provides the following functions:

  • check_mod_date

esak.utils.check_mod_date(data)

Remove a bad modification date from json data.

Parameters

data – Data from a Marvel API response.

Module contents

Project entry file.

esak.api(public_key: Optional[str] = None, private_key: Optional[str] = None, cache: Optional[SqliteCache] = None) Session

Entry function the sets login credentials for Marvel’s API.

Parameters
  • public_key (str, optional) – The user’s public key obtained from Marvel.

  • private_key (str, optional) – The user’s private key obtained from Marvel.

  • cache (SqliteCache, optional) – SqliteCache to use

Return type

Session

Raises

AuthenticationError – If Marvel credentials are missing.