Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afrogeo-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

afrogeo-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file afrogeo-0.1.0.tar.gz.

File metadata

  • Download URL: afrogeo-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for afrogeo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0fb4e48fb47e96a9ac25c3cd2ec67ac78cbdb3777c19b6ecf205de4c5722a7c
MD5 c1bc725d86ef0bc5983ef60ee7077c8b
BLAKE2b-256 9745d9725a7bcf986f617d13a2a10f24e9b7cbfdd57712c180094be41a18e9d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for afrogeo-0.1.0.tar.gz:

Publisher: publish.yml on 404codess/afrogeo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file afrogeo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: afrogeo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for afrogeo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7c35dbd55d1c98d6c61c1c0b1c1020dc44e275b2188bd0b302ca064eb070980
MD5 a06f9ebd0e93f2dc5284f25099851d77
BLAKE2b-256 0977488229e494cb1f5ca934789bc4a8f7d5ddf379ccef5abb42291db630d2b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for afrogeo-0.1.0-py3-none-any.whl:

Publisher: publish.yml on 404codess/afrogeo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page