A fully-typed Python client for the Marvel Comics API.
Project description
Marvelpyelleng
ell
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.0 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
- PyPI: https://pypi.org/project/marvelpy/
- GitHub: https://github.com/jlgranof/marvelpy
- Documentation: https://jlgranof.github.io/marvelpy/
- Issues: https://github.com/jlgranof/marvelpy/issues
Note: This package is actively developed. Version 0.2.0 includes a fully functional MarvelClient with character access, authentication, and comprehensive error handling. More endpoints and features are coming in future versions!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marvelpy-0.2.0.tar.gz.
File metadata
- Download URL: marvelpy-0.2.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5cf8c4b659341145eb53b9767a3181f039ce4f31ae3e7cdf5afe6a5c8277dd8
|
|
| MD5 |
9cff94850b12a23ab41c25c151bb650a
|
|
| BLAKE2b-256 |
f8773ec5614377df56996a49b3ab8e00177af54c93129d266930a972876b9574
|
File details
Details for the file marvelpy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: marvelpy-0.2.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58e514b4e59ee1047703fed28c45e0d52fe09fa240440267811f66ec57fce92b
|
|
| MD5 |
3d3a54c68f887bbb853a6fe9a080eb13
|
|
| BLAKE2b-256 |
53e8f457f528383105b7cdfac839f020696a7ee9f8ba2797c574b166dd77fcbf
|