Giter Site home page Giter Site logo

wrap-away / marvel-api Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 7.0 25 KB

API wrapper for Marvel

Home Page: https://developer.marvel.com/docs

License: MIT License

Python 100.00%
marvel marvel-api marvel-sdk marvel-developer marvel-comics python-marvel

marvel-api's Introduction

Marvel API

Installation

Using pip:

pip install marvel

This is an API wrapper for Marvel.

Usage

Usage is as simple as it gets:

from marvel import Marvel
m = Marvel(PUBLIC_KEY, PRIVATE_KEY)

Now there are six objects presented namely, characters, comics, creators, events, series and stories as listed at Developers

characters = m.characters
comics = m.comics
creators = m.creators
events = m.events
series = m.series
stories = m.stories

Each of the above object returns back the appropriate response (json) as mentioned in official docs

Module Examples

Module Examples:

m = Marvel(PUBLIC_KEY, PRIVATE_KEY)
characters = m.characters

Get All Characters:

all_characters = characters.all()

Get Single Character:

character = characters.get(1011334)

Get Some Character's Comics:

comics = characters.comics(1011334)

Similarly, you could apply the same logic to different objects, an example:

m = Marvel(PUBLIC_KEY, PRIVATE_KEY)
stories = m.stories
all_stores = stories.all()
story = stories.get(id)
events = stories.events(id)

Finally, the sub resources that each object has are as follows:

  • Characters
    • all, get, comics, events, series, stories
  • Comics
    • all, get, characters, creators, events, stories
  • Creators
    • all, get, comics, events, series, stories
  • Events
    • all, get, characters, comics, creators, series, stories
  • Series
    • all, get, characters, comics, creators, events, stories
  • Stories
    • all, get, characters, comics, creators, events, series

Exception Handling

You can catch any exception caused by Marvel API such as authentication error, bad input error, server down error, etc by handling the MarvelException at marvel/exceptions.py.

Running Tests

python -m pytest tests/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.