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.1.tar.gz (13.3 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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

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

Hashes for afrogeo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 663b65d5918726f4a2019432f8588ee7391cf03ac94f20aea279d2443c1d42b7
MD5 f24ba318fed0e85da18474a71f642a52
BLAKE2b-256 4abc64bbb2f89e841791bcd289f5d785639b0d6618d2581d8aba2fb5bff4a577

See more details on using hashes here.

Provenance

The following attestation bundles were made for afrogeo-0.1.1.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.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

Hashes for afrogeo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c83c473eb8c270dc5942211011ab29ed5a1c5885213bf7bccb1937cb2778bc3a
MD5 b865584b36aedea6b48f606f2f44060a
BLAKE2b-256 125054cb4926f4fee803231af8e2cebb6043c6212ed40c83d8fe69b6fdbf7df6

See more details on using hashes here.

Provenance

The following attestation bundles were made for afrogeo-0.1.1-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