Skip to main content

A fully-typed Python client for the Marvel Comics API.

Project description

Marvelpy

PyPI version Python 3.8+ License: MIT Documentation

A fully-typed Python client for the Marvel Comics API.

Features

  • 🚀 Async-first design - Built with modern async/await patterns
  • 🔒 Fully typed - Complete type hints for better IDE support
  • 📚 Comprehensive - Full coverage of the Marvel Comics API
  • 🛡️ Enterprise-ready - Production-grade error handling and retry logic
  • 📖 Well documented - Extensive documentation and examples

Quick Start

Installation

pip install marvelpy

Basic Usage

import asyncio
from marvelpy import MarvelClient

async def main():
    async with MarvelClient("your_public_key", "your_private_key") as client:
        # Get characters
        characters = await client.get_characters(params={"limit": 5})
        print(f"Found {characters['data']['count']} characters")

        # Search for specific characters
        iron_man = await client.get_characters(params={"name": "iron man"})
        print(f"Iron Man: {iron_man['data']['results'][0]['name']}")

asyncio.run(main())

What's Available

Currently, Marvelpy v0.2.1 includes:

  • MarvelClient - Full-featured async client for Marvel API
  • Authentication - Automatic Marvel API authentication
  • Character Access - Search and retrieve character information
  • Error Handling - Robust retry logic and error management
  • Type Safety - Complete type hints throughout
  • Test Suite - Comprehensive tests with 85% coverage
  • Documentation - Full API documentation with examples

Coming Soon

Future versions will include:

  • Comics - Access comic book data and metadata
  • Events - Marvel universe events and storylines
  • Series - Comic series information
  • Stories - Individual story details
  • Creators - Creator and artist information
  • Advanced Search - More sophisticated filtering options
  • Caching - Built-in response caching
  • Rate Limiting - Automatic rate limit management

Current Usage Examples

import asyncio
from marvelpy import MarvelClient

async def main():
    async with MarvelClient("your_public_key", "your_private_key") as client:
        # Get all characters (with pagination)
        characters = await client.get_characters(params={"limit": 10})

        # Search for specific characters
        heroes = await client.get_characters(params={"name": "iron man"})

        # Get character by ID
        character = await client.get("characters/1009368")

        # Health check
        status = await client.health_check()

asyncio.run(main())

Requirements

  • Python 3.8 or higher
  • httpx>=0.23.0
  • pydantic>=1.10.0
  • typing-extensions>=4.9.0
  • click>=8.1.0

Development

Setup

git clone https://github.com/jlgranof/marvelpy.git
cd marvelpy
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e ".[dev]"

Testing

pytest
pytest --cov=marvelpy --cov-report=html

Documentation

mkdocs serve  # Serve docs locally
mkdocs build  # Build docs

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Documentation

License

This project is licensed under the MIT License.

Links


Note: This package is actively developed. Version 0.2.1 includes a fully functional MarvelClient with character access, authentication, and comprehensive error handling. More endpoints and features are coming in future versions!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marvelpy-0.2.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marvelpy-0.2.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file marvelpy-0.2.1.tar.gz.

File metadata

  • Download URL: marvelpy-0.2.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for marvelpy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f5ac58022976f41319585e4381de429d66a69823bc79d31898a992753781e481
MD5 cc02833e4408b99cb6fd077093c1c923
BLAKE2b-256 e4af5501d18018f2df3455b150dc05c4fa3ea0e4c71f3826a54477f96c337346

See more details on using hashes here.

File details

Details for the file marvelpy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: marvelpy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for marvelpy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 23f7b80d320d250565b953f1021f1a608badda465959f12b6e77800ea698ef4d
MD5 ec3c349ea0654f08b2ebb8db036c49f6
BLAKE2b-256 c0a83fad88f666ccdec9a5f5710ff3743d065556be4d04a6d82b410d9588c2ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page