apogeoapi — Python SDK
Official Python client for ApogeoAPI. IP geolocation, countries, cities, states, and exchange rates. Zero dependencies.
Installation
pip install apogeoapi
Requires Python ≥ 3.9. No third-party dependencies.
Quick start
from apogeoapi import ApogeoAPIClient
client = ApogeoAPIClient(api_key="your_key_here")
# Country info
country = client.get_country("DE")
print(country["name"]["common"]) # Germany
print(country["capital"]) # Berlin
print(country["currencies"]) # {"EUR": {...}}
# IP geolocation
geo = client.geolocate_ip("8.8.8.8")
print(geo["country"]["name"]) # United States
print(geo["city"]) # Mountain View
print(geo["timezone"]) # America/Los_Angeles
print(geo["isp"]) # Google LLC
# Exchange rate (relative to USD)
rate = client.get_currency_rate("EUR")
print(rate["usdRate"]) # e.g. 0.9214
# List all countries in a region
europe = client.list_countries(region="Europe")
print(len(europe)) # 44
# States/provinces
states = client.get_states("BR")
print(states[0]["name"]) # Acre
# Cities
cities = client.get_cities("MX", state="Jalisco", limit=5)
# Full-text search
results = client.search_countries("united")
# → [United States, United Kingdom, United Arab Emirates, ...]
# Global search (countries + cities + currencies)
all_results = client.global_search("paris")
API Reference
| Method | Description |
|---|---|
list_countries(region, subregion, limit, offset, fields) |
List all countries |
get_country(code, fields) |
Country by ISO2 or ISO3 code |
search_countries(query, limit) |
Search countries by name |
get_states(country_code) |
States/provinces for a country |
get_cities(country_code, state, limit, offset) |
Cities, optionally filtered by state |
geolocate_ip(ip) |
Geolocate IPv4 or IPv6 |
get_currency_rate(currency_code) |
USD exchange rate for a currency |
list_exchange_rates() |
All 161 supported currencies |
global_search(query, limit) |
Search across all data types |
Error handling
from apogeoapi import (
ApogeoAPIClient,
ApogeoAPIError,
ApogeoAPIAuthError,
ApogeoAPIRateLimitError,
)
try:
data = client.get_country("XX")
except ApogeoAPIAuthError:
print("Invalid API key — get one at https://apogeoapi.com")
except ApogeoAPIRateLimitError:
print("Rate limit hit — upgrade at https://apogeoapi.com/pricing")
except ApogeoAPIError as e:
print(f"API error {e.status_code}: {e}")
Get an API key
Sign up at apogeoapi.com. Free plan: 1,000 requests/month with a 14-day full-access trial on signup.
License
MIT
Metadata
Release files for apogeoapi 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 | Provenance | Actions |
|---|---|---|---|---|
| apogeoapi-1.0.0.tar.gz | 5.0 kB | Without provenance | Details for apogeoapi-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apogeoapi-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for apogeoapi-1.0.0-py3-none-any.whl |
Total release size: 10.1 kB
Release files / apogeoapi-1.0.0.tar.gz
| Download URL | apogeoapi-1.0.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f07824ba06d11330e0b33292a7721e8e4cc201d3e6cc5e653a7fcf5c769da455
|
|
BLAKE2b-256 checksum How to use checksums |
2307bd9e2a7ed54a34c243e10160b0ea2c6494942f98bd76e688afd72b32940e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / apogeoapi-1.0.0-py3-none-any.whl
| Download URL | apogeoapi-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc9f98d07e936c3389fc85c8d5940748178ed1da86dc5e00669f0a3b3e78e550
|
|
BLAKE2b-256 checksum How to use checksums |
ed4500ca40feba3476c5eec43e11b6df813204bd60d0fdbe5eb16fb721bb17a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Security for apogeoapi 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.