Python wrapper for Metron API
Project description
Mokkari
A python wrapper for the Metron Comic Book Database API.
Installation
pip install mokkari
Example Usage
import mokkari
# Your own config file to keep your credentials secret
from config import username, password
m = mokkari.api(username, password)
# Get all Marvel comics for the week of 2021-06-07
this_week = m.issues_list({"store_date_range_after": "2021-06-07", "store_date_range_before": "2021-06-13", "publisher_name": "marvel"})
# Print the results
for i in this_week:
print(f"{i.id} {i.issue_name}")
# Retrieve the detail for an individual issue
asm_68 = m.issue(31660)
# Print the issue Description
print(asm_68.desc)
Rate Limiting
The API has rate limits of 20 requests per minute and 5,000 requests per day.
Mokkari automatically enforces these limits locally to prevent unnecessary API
calls. When a rate limit is exceeded, a RateLimitError is raised.
Handling Rate Limits
The RateLimitError includes a retry_after attribute that tells you exactly
how many seconds to wait before making another request:
import mokkari
from mokkari.exceptions import RateLimitError
import time
m = mokkari.api(username, password)
try:
issue = m.issue(31660)
except RateLimitError as e:
# Display user-friendly message
print(f"Rate limited: {e}")
# Programmatically wait for the exact time needed
print(f"Waiting {e.retry_after} seconds...")
time.sleep(e.retry_after)
# Retry the request
issue = m.issue(31660)
Documentation
Read the project documentation
Bugs/Requests
Please use the GitHub issue tracker to submit bugs or request features.
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 mokkari-3.24.0.tar.gz.
File metadata
- Download URL: mokkari-3.24.0.tar.gz
- Upload date:
- Size: 354.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ec014a16dddae27a9810445fb0af8ab98d88b46a907b33a55294b31bb2a026a
|
|
| MD5 |
a34bca9837aa153af38130fef390307d
|
|
| BLAKE2b-256 |
8c6aa0d18796a3ba7b41336846691452ebb6192b7e57bfec926fffd233e09b87
|
File details
Details for the file mokkari-3.24.0-py3-none-any.whl.
File metadata
- Download URL: mokkari-3.24.0-py3-none-any.whl
- Upload date:
- Size: 51.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93972d4efd2eeda6c7aa9a41bc9b5c50b3e0a95a5cd669034e5201ec02f9dced
|
|
| MD5 |
ea46b77f46e33e769112d1685adc4fba
|
|
| BLAKE2b-256 |
1769276866577417244b81524c6d541e8c374d11358def433763f41962e9df2f
|