malloryapi
Official Python client for the Mallory threat intelligence API.
Installation
pip install malloryapi
# or
uv add malloryapi
Quick Start
from malloryapi import MalloryApi
client = MalloryApi(api_key="your-api-key")
# List recent vulnerabilities
vulns = client.vulnerabilities.list(limit=10)
for v in vulns:
print(v["cve_id"], v.get("cvss_base_score"))
# Get a specific vulnerability
vuln = client.vulnerabilities.get("CVE-2024-1234")
# Trending threat actors (last 7 days)
actors = client.threat_actors.trending(period="7d")
Authentication
Pass your API key directly or set the MALLORY_API_KEY environment variable:
# Explicit
client = MalloryApi(api_key="sk-...")
# From environment
import os
os.environ["MALLORY_API_KEY"] = "sk-..."
client = MalloryApi()
Async Support
from malloryapi import AsyncMalloryApi
async with AsyncMalloryApi(api_key="sk-...") as client:
vulns = await client.vulnerabilities.list(limit=10)
actor = await client.threat_actors.get("apt28-uuid")
Resources
Entities
| Resource | Accessor | Key Methods |
|---|---|---|
| Vulnerabilities | client.vulnerabilities |
list, get, trending, exploited, export, exploits, mentions, products, observables |
| Threat Actors | client.threat_actors |
list, get, trending, export, mentions, observables, attack_patterns |
| Malware | client.malware |
list, get, trending, export, mentions, observables, vulnerabilities, attack_patterns |
| Exploits | client.exploits |
list, get, export, vulnerabilities |
| Exploitations | client.exploitations |
list, get |
| Organizations | client.organizations |
list, get, trending, export, mentions, products, breaches |
| Products | client.products |
list, get, trending, search, export, advisories, mentions |
| Attack Patterns | client.attack_patterns |
list, get, trending, mentions, threat_actors, malware |
| Breaches | client.breaches |
list, get, organizations |
| Detection Signatures | client.detection_signatures |
list, get |
| Advisories | client.advisories |
list, get, export, products, vulnerabilities |
| Weaknesses | client.weaknesses |
list, get |
Content
| Resource | Accessor | Key Methods |
|---|---|---|
| Stories | client.stories |
list, get, topics, references, events, similar, entities, export |
| References | client.references |
list, get, create, labels, entities, threat_actors, vulnerabilities |
| Sources | client.sources |
list, statistics |
| Content Chunks | client.content_chunks |
list, get, search |
Analytics
| Resource | Accessor | Key Methods |
|---|---|---|
| Mentions | client.mentions |
list, actors, vulnerabilities |
| Search | client.search |
query |
Pagination
All list methods return a PaginatedResponse with .items, .total, .offset, .limit, and .has_more:
page = client.vulnerabilities.list(offset=0, limit=50)
print(f"Showing {len(page)} of {page.total}")
if page.has_more:
next_page = client.vulnerabilities.list(offset=50, limit=50)
Auto-pagination
Iterate over all results automatically:
from malloryapi import paginate_sync
for vuln in paginate_sync(client.vulnerabilities.list, limit=100):
print(vuln["cve_id"])
Async version:
from malloryapi import paginate_async
async for vuln in paginate_async(client.vulnerabilities.list):
print(vuln["cve_id"])
Trending
Entities with trending support accept a period parameter ("1d", "7d", or "30d"):
# Trending vulnerabilities over the last 30 days
vulns = client.vulnerabilities.trending(period="30d")
# Trending threat actors (defaults to 7 days)
actors = client.threat_actors.trending()
Error Handling
from malloryapi import MalloryApi, NotFoundError, AuthenticationError
client = MalloryApi(api_key="sk-...")
try:
vuln = client.vulnerabilities.get("CVE-9999-0000")
except NotFoundError:
print("Vulnerability not found")
except AuthenticationError:
print("Invalid API key")
All exceptions inherit from APIError and include status_code and response_body attributes.
License
Apache 2.0
Metadata
Release files for malloryapi 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| malloryapi-0.3.0.tar.gz | 41.0 kB | With provenance | Details for malloryapi-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| malloryapi-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for malloryapi-0.3.0-py3-none-any.whl |
Total release size: 83.5 kB
Release files / malloryapi-0.3.0.tar.gz
| Download URL | malloryapi-0.3.0.tar.gz |
|---|---|
| Size | 41.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
403840c0e5a326cd5704c44b3cecf348c336ab7ae87f86d53dfb0825fbd3beda
|
|
BLAKE2b-256 checksum How to use checksums |
46ef289d6ad2e38d0d4f3503898754fab575a54c73f5e82bbc1cd449aeccf3d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logRelease files / malloryapi-0.3.0-py3-none-any.whl
| Download URL | malloryapi-0.3.0-py3-none-any.whl |
|---|---|
| Size | 42.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7811faecd11f2edd1c35b5d79aa358d82c526cef965852941fcd20c431449468
|
|
BLAKE2b-256 checksum How to use checksums |
0e0f37f5bd6754ad70bb0963d71852894b930852011ec6557115be1c8b39eb51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logSecurity for malloryapi 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for malloryapi-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.