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.
Metadata
Release files for focsec 1.0.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 | |
|---|---|---|---|
| focsec-1.0.0.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| focsec-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / focsec-1.0.0.tar.gz
| Download URL | focsec-1.0.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d85536a349fa630927765bbf1538321b6fe56708bd0d2149e21b846d8f5d2b8
|
|
BLAKE2b-256 checksum How to use checksums |
550f90c2bb72df1c1dc14c16faf68609662f45439d5236e09093148877e26d39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / focsec-1.0.0-py3-none-any.whl
| Download URL | focsec-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c675088c2bcf2425c1fac1b702642e59963d3e1f8b285ef87da5fe5c460eeb70
|
|
BLAKE2b-256 checksum How to use checksums |
993f948208bbfe096be86d7c897bcc7830efc4f8c18e3d4a0e214a563dcb9709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|