Offline-first African location verification for Python.
Project description
Afrogeo
Offline-first African location verification for Python.
Validate country, state, city, and district (LGA) without an internet connection.
Installation
pip install afrogeo
Usage
Afrogeo provides a simple verify function that takes a dictionary and returns a Result object.
Basic Example
from afrogeo import verify
data = {
"country": "Nigeria",
"state": "Lagos",
"lga": "Agege"
}
result = verify(data)
if result.valid:
print(f"Validated: {result.normalized['state']} - {result.normalized['lga']}")
else:
print(f"Errors: {result.errors}")
Full Validation (including City)
data = {
"country": "NG", # Supports codes or full names
"state": "LA", # Supports state codes
"lga": "Agege",
"city": "Agege" # Optional
}
result = verify(data)
Features
- Offline-First: Uses local JSON data for instant verification.
- Data Normalization: Automatically converts codes to full names and vice-versa.
- Case Insensitive: Accepts "LAGOS", "lagos", or "Lagos".
- Dynamic Loading: Loads only the data for the country you are verifying.
API Reference
verify(user_input: dict) -> Result
The user_input dictionary accepts:
country(Required): Full name or ISO code.state(Required): Full name or code.lga(Required): Local Government Area name.city(Optional): City name.
Returns a Result object with:
valid: Boolean.errors: List of strings (empty if valid).normalized: Dictionary of standard location names and codes.
Contributing
Data is stored in afrogeo/data/. To add a new country, create a <country_code>.json file following the existing structure.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file afrogeo-0.1.1.tar.gz.
File metadata
- Download URL: afrogeo-0.1.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
663b65d5918726f4a2019432f8588ee7391cf03ac94f20aea279d2443c1d42b7
|
|
| MD5 |
f24ba318fed0e85da18474a71f642a52
|
|
| BLAKE2b-256 |
4abc64bbb2f89e841791bcd289f5d785639b0d6618d2581d8aba2fb5bff4a577
|
Provenance
The following attestation bundles were made for afrogeo-0.1.1.tar.gz:
Publisher:
publish.yml on 404codess/afrogeo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
afrogeo-0.1.1.tar.gz -
Subject digest:
663b65d5918726f4a2019432f8588ee7391cf03ac94f20aea279d2443c1d42b7 - Sigstore transparency entry: 1659922457
- Sigstore integration time:
-
Permalink:
404codess/afrogeo@c4bb4f0f24211638219957f842a9b8345c1dee72 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/404codess
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c4bb4f0f24211638219957f842a9b8345c1dee72 -
Trigger Event:
release
-
Statement type:
File details
Details for the file afrogeo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: afrogeo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c83c473eb8c270dc5942211011ab29ed5a1c5885213bf7bccb1937cb2778bc3a
|
|
| MD5 |
b865584b36aedea6b48f606f2f44060a
|
|
| BLAKE2b-256 |
125054cb4926f4fee803231af8e2cebb6043c6212ed40c83d8fe69b6fdbf7df6
|
Provenance
The following attestation bundles were made for afrogeo-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on 404codess/afrogeo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
afrogeo-0.1.1-py3-none-any.whl -
Subject digest:
c83c473eb8c270dc5942211011ab29ed5a1c5885213bf7bccb1937cb2778bc3a - Sigstore transparency entry: 1659922509
- Sigstore integration time:
-
Permalink:
404codess/afrogeo@c4bb4f0f24211638219957f842a9b8345c1dee72 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/404codess
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c4bb4f0f24211638219957f842a9b8345c1dee72 -
Trigger Event:
release
-
Statement type: