pygeocodio

raw JSON →
2.0.1 verified Fri May 01 auth: no python

Python wrapper for the Geocod.io API. Current version 2.0.1, released 2024. Active development with regular releases.

pip install pygeocodio
error ImportError: cannot import name 'GeocodioClient' from 'pygeocodio'
cause GeocodioClient is not exposed in the package's __init__.py.
fix
Use: from pygeocodio.client import GeocodioClient
error TypeError: __init__() missing 1 required positional argument: 'api_key'
cause API key not provided when creating GeocodioClient.
fix
Pass api_key argument: GeocodioClient(api_key='your_key') or set environment variable GEOCODIO_API_KEY.
error urllib.error.HTTPError: HTTP Error 401: Unauthorized
cause Invalid or missing API key.
fix
Check your API key and ensure it's set correctly. You can also set the GEOCODIO_API_KEY environment variable.
breaking In version 2.0.0, the default value of auto_load_api_version changed from True to False. This can cause errors if your code relied on auto-loading.
fix Explicitly set auto_load_api_version=True when creating GeocodioClient if you need auto-loading.
deprecated Support for Python 3.8 and earlier has been dropped. Python 3.9+ required as of v2.0.1.
fix Upgrade to Python 3.9 or higher.
gotcha The GeocodioClient is not importable from the top-level package (pygeocodio). Attempting 'from pygeocodio import GeocodioClient' will raise ImportError.
fix Use 'from pygeocodio.client import GeocodioClient'.

Initialize client with API key and geocode an address.

from pygeocodio.client import GeocodioClient

client = GeocodioClient(api_key='your_api_key_here')
# Geocode a single address
result = client.geocode('42370 Bob Hope Dr, Rancho Mirage, CA 92270')
print(result)