Skip to main content

Python SDK for the Focsec IP and VPN detection API

Project description

Focsec Python SDK

Python SDK and CLI tool for the Focsec Threat Intelligence and VPN Detection API.

Focsec provides comprehensive IP intelligence data, including VPN detection, proxy detection, bot detection, and more. This SDK simplifies integration with the Focsec API, allowing you to easily access IP data and perform various checks in your Python-baed project.

Installation

pip install focsec

Quick Start

SDK

from focsec import FocsecClient

# Initialize the client with your API key
client = FocsecClient(api_key="your-api-key-here")

# Get IP information
result = client.ip("84.118.20.205")
print(f"IP: {result.ip}")
print(f"Is VPN: {result.is_vpn}")
print(f"Is Proxy: {result.is_proxy}")
print(f"Is TOR: {result.is_tor}")
print(f"Is Bot: {result.is_bot}")
print(f"Is Datacenter: {result.is_datacenter}")
# More information available: country, city, iso_code, is_in_european_union, flag, autonomous_system_number, autonomous_system_organization	

Command Line Interface

This package also includes a command line interface (CLI) for quick access to the API without writing any code.

# Set your API key (or use --api-key flag)
export FOCSEC_API_KEY=your-api-key-here

# Look up an IP address
focsec ip 8.8.8.8

# Output in single line JSON format
focsec ip 8.8.8.8 --json

Error Handling

The SDK provides a simple exception hierarchy:

FocsecError (base - catch any SDK error)
├── ClientError (4xx - fixable by user)
│   ├── BadRequestError (400)
│   ├── AuthenticationError (401)
│   ├── PaymentRequiredError (402)
│   ├── NotFoundError (404)
│   └── MethodNotAllowedError (405)
├── ServerError (5xx - server issues)
│   ├── InternalServerError (500)
│   ├── BadGatewayError (502)
│   └── ServiceUnavailableError (503)
├── RateLimitError (429 - rate limit exceeded)
├── ValidationError (client-side validation)
└── APIError (unexpected status codes)

API Documentation

For further API documentation, please visit docs.focsec.com.

License

MIT License

Questions?

Contact us at support@focsec.com for any questions or issues.

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

focsec-1.0.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

focsec-1.0.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file focsec-1.0.0.tar.gz.

File metadata

  • Download URL: focsec-1.0.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for focsec-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0d85536a349fa630927765bbf1538321b6fe56708bd0d2149e21b846d8f5d2b8
MD5 d6adfbc0083e7f671b4a45c37b1c853b
BLAKE2b-256 550f90c2bb72df1c1dc14c16faf68609662f45439d5236e09093148877e26d39

See more details on using hashes here.

File details

Details for the file focsec-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: focsec-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for focsec-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c675088c2bcf2425c1fac1b702642e59963d3e1f8b285ef87da5fe5c460eeb70
MD5 18965a1c1ce0a7a9ed968db821ed91be
BLAKE2b-256 993f948208bbfe096be86d7c897bcc7830efc4f8c18e3d4a0e214a563dcb9709

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