security.dev Python SDK
Project description
security.dev Python Client (securitydev)
A modern Python client for the security.dev API, built using httpx and pydantic. Supports both synchronous (default) and asynchronous usage.
Features
- Synchronous (
SecurityClient) and Asynchronous (AsyncSecurityClient) interfaces. - API endpoints grouped under namespaces (e.g.,
client.ip_intel). - Modern implementation using
httpx. - Data validation using
pydanticwith safe nested attribute access. - Simple and intuitive interface.
- Type-hinted for a better developer experience.
- Clean error handling for API responses.
Installation
Install using pip (or any other manager):
pip install securitydev
Requirements
- Python 3.8+
- A security.dev API key, available from security.dev.
Quick Examples
Synchronous Usage
import os
from securitydev import SecurityClient
key = os.getenv("SECURITYDEV_KEY")
with SecurityClient(key=key) as client:
reputation = client.ip_intel.reputation("8.8.8.8")
print(f"8.8.8.8 - Is Abuser: {reputation.is_abuser}")
You don't necessarily need to use the context manager.
import os
from securitydev import SecurityClient
key = os.getenv("SECURITYDEV_KEY")
client = SecurityClient(key=key)
ip = "1.1.1.1"
rep = client.ip_intel.reputation(ip)
if rep.is_tor_exit:
print(f"{ip} is a Tor exit.")
Asynchronous Usage
import os
import asyncio
from securitydev import AsyncSecurityClient
async def main():
async with AsyncSecurityClient(key=os.getenv("SECURITYDEV_KEY")) as client:
geoip = await client.ip_intel.geolocate("1.1.1.1")
print(f"1.1.1.1 - Country: {geoip.country.name}")
asyncio.run(main())
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
securitydev-1.0.0.tar.gz
(20.7 kB
view details)
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 securitydev-1.0.0.tar.gz.
File metadata
- Download URL: securitydev-1.0.0.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
702f8b98b274ff3b5c7bfe2164e7f90f2cdd77f7f6ec99d62fb59b096d258099
|
|
| MD5 |
1d06c190bb9b9a834158f0d42653fefe
|
|
| BLAKE2b-256 |
bf4484633132c4dabe4468f98b4e10f576eb13708311ef4d4a1fdef9ee209e48
|
File details
Details for the file securitydev-1.0.0-py3-none-any.whl.
File metadata
- Download URL: securitydev-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19512064bbe1569641adc904676bb0f0999bd8d6c1ede37d568685efd6dd5036
|
|
| MD5 |
bec500f39f002f25222acdbb009a9b2d
|
|
| BLAKE2b-256 |
85055e456bf7f0e8a7461e25dca91c201d2f98519797ceba745009e270a29314
|