Official Python SDK for ipc.artsnoa.com API - Get your IP address and location information.
- Simple and intuitive API
- Type hints for better IDE support
- Comprehensive error handling
- Context manager support
- Minimal dependencies
pip install ipc-artsnoaOr with uv:
uv add ipc-artsnoafrom ipc_artsnoa import IPCClient
# Initialize client (API key is optional)
client = IPCClient(api_key='YOUR_API_KEY')
# Get basic IP information
data = client.get_ip()
print(f'Your IP: {data["ip"]}, Country: {data["country"]}')
# Get detailed IP information
details = client.get_ip_details()
print(f'IP: {details["ip"]}, ASN: {details["asn"]}, Currency: {details["currency"]}')from ipc_artsnoa import IPCClient
# Create client with API key
client = IPCClient(api_key='YOUR_API_KEY')
# Get basic IP information
data = client.get_ip()
print(f"IP: {data['ip']}")
print(f"Country: {data['country']}")
# Without API key
client = IPCClient()
data = client.get_ip()
print(f"Your IP: {data['ip']}")from ipc_artsnoa import IPCClient
client = IPCClient(api_key='YOUR_API_KEY')
# Get detailed information including ASN, currency, languages
details = client.get_ip_details()
print(f"IP: {details['ip']}")
print(f"User Agent: {details['userAgent']}")
print(f"ASN: {details['asn']}")
print(f"Country: {details['country']}")
print(f"Currency: {details['currency']}")
print(f"Languages: {details['languages']}")
print(f"Timestamp: {details['timestamp']}")from ipc_artsnoa import IPCClient
client = IPCClient()
# Get available SDK versions
versions = client.get_sdk_versions()
print(f"Python SDK: {versions['python']}")
print(f"JavaScript SDK: {versions['javascript']}")from ipc_artsnoa import IPCClient
# Custom timeout
client = IPCClient(
api_key='YOUR_API_KEY',
timeout=15.0
)
data = client.get_ip()from ipc_artsnoa import IPCClient
# Automatically closes session when done
with IPCClient(api_key='YOUR_API_KEY') as client:
data = client.get_ip()
print(f"IP: {data['ip']}")The SDK provides specific exception types for different error scenarios:
from ipc_artsnoa import (
IPCClient,
IPCError,
IPCAPIError,
IPCConnectionError,
IPCTimeoutError
)
client = IPCClient(api_key='YOUR_API_KEY')
try:
data = client.get_ip()
print(f"Your IP: {data['ip']}")
except IPCAPIError as e:
print(f"API error: {e}")
if hasattr(e, 'status_code'):
print(f"Status code: {e.status_code}")
except IPCConnectionError as e:
print(f"Connection error: {e}")
except IPCTimeoutError as e:
print(f"Request timeout: {e}")
except IPCError as e:
print(f"IPC error: {e}")IPCClient(
api_key: str | None = None,
timeout: float = 10.0
)Parameters:
api_key(str | None): API key for authentication. Optional.timeout(float): Request timeout in seconds. Defaults to 10.0
Get basic IP address and location information.
Returns:
- Dictionary containing basic IP information including:
ip: Your IP addresscountry: Country code
Raises:
IPCAPIError: When API returns an error responseIPCConnectionError: When connection failsIPCTimeoutError: When request times out
Example:
data = client.get_ip()
print(f"IP: {data['ip']}, Country: {data['country']}")Get detailed IP address information.
Returns:
- Dictionary containing detailed IP information including:
ip: Your IP addressuserAgent: Browser user agent stringasn: Autonomous System Numbercountry: Country codecurrency: Country currency codelanguages: Supported languagestimestamp: Request timestampversion: API version
Raises:
IPCAPIError: When API returns an error responseIPCConnectionError: When connection failsIPCTimeoutError: When request times out
Example:
details = client.get_ip_details()
print(f"IP: {details['ip']}, ASN: {details['asn']}")Get available SDK versions.
Returns:
- Dictionary containing SDK versions for different platforms:
python: Python SDK versionjavascript: JavaScript SDK version
Raises:
IPCAPIError: When API returns an error responseIPCConnectionError: When connection failsIPCTimeoutError: When request times out
Example:
versions = client.get_sdk_versions()
print(f"Python SDK: {versions['python']}")Close the underlying HTTP session.
Example:
client.close()The client supports context manager protocol for automatic resource cleanup:
with IPCClient(api_key='YOUR_API_KEY') as client:
data = client.get_ip()# Clone repository
git clone https://github.com/artsnoa/ipc-python-sdk.git
cd ipc-python-sdk
# Install dependencies with uv
uv sync
# Build package
uv build- Python 3.10 or higher
- requests >= 2.31.0
MIT License
- Documentation: https://github.com/artsnoa/ipc-python-sdk
- Issues: https://github.com/artsnoa/ipc-python-sdk/issues
- Email: aurora@artsnoa.com