AfriGIS Python Search Client
Overview
AfriGIS Python Search Client is a modern, async Python SDK for seamless integration with the AfriGIS Search suite of APIs. It provides robust, versioned, and strongly-typed access to Autocomplete, Geocode, Place Details, and Delivery Address Format APIs, handling authentication, request formatting, and error mapping for you.
- Token-based authentication (OAuth2)
- API key support
- Strongly-typed request/response models (Pydantic)
- Async API for scalable apps
- Comprehensive error handling
- Thread/async-safe and production-ready
- Versioned endpoints for future compatibility
Installation
Install via pip (after building or from PyPI):
pip install afrigis-search-client
Configuration
You can provide credentials via environment variables, .env file, or directly as parameters. Example .env:
AFRIGIS_AUTH_URL=https://auth.afrigis.services
AFRIGIS_CLIENT_ID=your-client-id
AFRIGIS_CLIENT_SECRET=your-client-secret
AFRIGIS_API_KEY=your-api-key
Client Initialization
from afrigis_search_client import AfrigisSearchClient
import os
client = AfrigisSearchClient(
client_id=os.getenv("AFRIGIS_CLIENT_ID"),
client_secret=os.getenv("AFRIGIS_CLIENT_SECRET"),
api_key=os.getenv("AFRIGIS_API_KEY")
)
Usage Examples
All endpoints are async and raise exceptions for error conditions. See below for details on which exceptions are raised and when.
Autocomplete
result = await client.autocomplete.v3.autocomplete(query="446 Rigel", max_results=5)
for suggestion in result.result:
print(f"{suggestion.description} ({suggestion.country})")
Geocoding
result = await client.geocode.v3.geocode_address(query="446 Rigel Avenue South, Erasmusrand", max_results=5)
for address in result.result:
print(f"{address.formatted_address} - {address.location}")
Place Details
result = await client.details.v3.get_details(reference="2XIAs5De9f_eEXNFubwV-ZXI41F281017")
print(result.result.formatted_address)
print(result.result.location)
Delivery Address Lookup
result = await client.delivery.v1.get_delivery(reference="2XIAs5De9f_eEXNFubwV-ZXI41F281017")
print(result.result.formatted_address)
print(result.result.delivery)
Autocomplete/Geocode with IncludeTypes/ExcludeTypes
result = await client.autocomplete.v3.autocomplete(
query="446 Rigel",
max_results=5,
include_types=["street_address_level_1", "locality"],
exclude_types=["administrative_area_level_1"]
)
Exception Handling
All endpoints raise exceptions for error conditions:
ValueError: For invalid input (e.g., empty query)Exception: For API errors, network errors, or response validation errors
Thread Safety & Token Management
- The client is async/thread-safe and manages authentication tokens automatically.
- Tokens are refreshed as needed; you do not need to handle this yourself.
API Reference
Support & Further Resources
- Contact AfriGIS for production support and API documentation
Metadata
Release files for afrigis-search-client 0.1.1
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 | |
|---|---|---|---|---|
| afrigis_search_client-0.1.1.tar.gz | 12.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| afrigis_search_client-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.3 kB
Release files / afrigis_search_client-0.1.1.tar.gz
| Download URL | afrigis_search_client-0.1.1.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a60c815d8341e5d6be27ade26b773baa02634ca817138b4ac5151703ffdadcd
|
|
BLAKE2b-256 checksum How to use checksums |
b2a64fc528d10f7e317d9e586ea54b023ca5f2025ea67ebfeeb47a0f5766e746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / afrigis_search_client-0.1.1-py3-none-any.whl
| Download URL | afrigis_search_client-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e522a41ea4d1a77e02ed24d02208eaa3162c3f6365e5c5da557035a73bf4e2ef
|
|
BLAKE2b-256 checksum How to use checksums |
8d4d7d4b6ba161d33f40c5fcf95ecae6bc6b50be53404df99e4bf77da3968764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for afrigis-search-client 0.1.1
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.