Skip to main content

security.dev Python SDK

Project description

security.dev Python SDK

PyPI version

A modern Python client for the security.dev API, built using httpx and pydantic. Supports both synchronous (default) and asynchronous usage.

Features

  • Synchronous and Asynchronous interfaces.
  • Data validation using pydantic.
  • Simple and intuitive interface.
  • Type-hinted.

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.2.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

securitydev-1.0.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file securitydev-1.0.2.tar.gz.

File metadata

  • Download URL: securitydev-1.0.2.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for securitydev-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f3f595e2098d1ad42a7f7d67027698dbb2ddc1b28888aae0b1108d157edd8dc4
MD5 b07ed0643cc92651af8b8c0da8e09815
BLAKE2b-256 433da1495749c3a3ef0ce2d6c649ae50a3b8e037c1eb730b58913512be3baad4

See more details on using hashes here.

File details

Details for the file securitydev-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for securitydev-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d973f5c95128230326e8a20e61c8b3a39bd8a1cae62d819f9114ff6eb3f5f2ba
MD5 55ec67ffd9c051728db464bbdaf64d2e
BLAKE2b-256 1de5776706a950ea56560503463da35812c59e766874b98d7ebd930ca905824a

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