Core Module

class marvel.core.DataContainer(marvel, dict)

Base DataContainer

count

The total number of results returned by this call.

Returns:int

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

limit

The requested result limit.

Returns:int
list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

offset

The requested offset (number of skipped results) of the call.

Returns:int
resource_url()
Returns:str – Resource URL
result

Returns the first item in the results list. Useful for methods that should return only one results.

Returns:marvel.MarvelObject
str_to_datetime(_str)

Converts ‘2013-11-20T17:40:18-0500’ format to ‘datetime’ object

Returns:datetime
to_dict()
Returns:dict – Dictionary representation of the Resource
total

The total number of resources available given the current filter set.

Returns:int
class marvel.core.DataWrapper(marvel, dict, params=None)

Base DataWrapper

code

The HTTP status code of the returned result.

Returns:int
etag

A digest value of the content returned by the call.

Returns:str

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

resource_url()
Returns:str – Resource URL
status

A string description of the call status.

Returns:str
to_dict()
Returns:dict – Dictionary representation of the Resource
class marvel.core.Image(marvel, dict)
extension

The file extension for the image.

Returns:str

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

path

The directory path of to the image.

Returns:str
resource_url()
Returns:str – Resource URL
to_dict()
Returns:dict – Dictionary representation of the Resource
class marvel.core.List(marvel, dict)

Base List object

available

The number of total available resources in this list. Will always be greater than or equal to the “returned” value.

Returns:int
collectionURI

The path to the full list of resources in this collection.

Returns:str

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

resource_url()
Returns:str – Resource URL
returned

The number of resources returned in this collection (up to 20).

Returns:int
to_dict()
Returns:dict – Dictionary representation of the Resource
class marvel.core.MarvelObject(marvel, dict)

Base class for all Marvel API classes

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

classmethod resource_url()
Returns:str – Resource URL
to_dict()
Returns:dict – Dictionary representation of the Resource
class marvel.core.Summary(marvel, dict)

Base Summary object

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

name

The canonical name of the resource.

Returns:str
resourceURI

The path to the individual resource.

Returns:str
resource_url()
Returns:str – Resource URL
to_dict()
Returns:dict – Dictionary representation of the Resource
class marvel.core.TextObject(marvel, dict)

Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics

Parameters:
  • _Class (core.MarvelObject) – The Resource class retrieve
  • _ClassDataWrapper – The Resource response object
  • kwargs (dict) – dict of query params for the API
Returns:

DataWrapper – DataWrapper for requested Resource

language

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

Returns:str
list_to_instance_list(_self, _list, _Class)

Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param.

Parameters:
  • _self (core.MarvelObject) – Original resource calling the method
  • _list (list) – List of dicts describing a Resource.
  • _Class (core.MarvelObject) – The Resource class to create a list of (Comic, Creator, etc).
Returns:

list – List of Resource instances (Comic, Creator, etc).

resource_url()
Returns:str – Resource URL
text

The text.

Returns:str
to_dict()
Returns:dict – Dictionary representation of the Resource
type

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

Returns:str