Skip to main content

Typed Python clients for Mailwoman's Photon / Nominatim / libpostal drop-in geocoding APIs and native /v1/* surface, generated from their OpenAPI specs.

Project description

mailwoman-client (Python)

Typed Python clients for Mailwoman's HTTP surfaces — generated from their published OpenAPI specs and bundled under one distributable:

Subpackage Surface Endpoints
mailwoman_client.photon Photon drop-in /api, /reverse
mailwoman_client.nominatim Nominatim drop-in /search, /reverse, /lookup, /status
mailwoman_client.libpostal libpostal drop-in /parse, /expand
mailwoman_client.mailwoman Native surface /v1/parse, /v1/geocode, /v1/batch, /v1/resolve, /v1/format

The four subpackages are generated verbatim by openapi-python-client (it runs its own ruff pass) and are overwritten on regen — do not hand-edit them. The only hand-written code is the thin ergonomics layer in mailwoman_client/__init__.py: PhotonClient / NominatimClient / LibpostalClient / MailwomanClient, each with a sensible default base_url. Regenerate with mailwoman clients generate (see the repo's docs/articles/api.mdx "Client libraries" section) — nothing here is hand-maintained.

Not yet published. This package is built and verified on every mailwoman clients generate run; publishing to PyPI happens from the gated CI job once the operator provisions a PyPI account (see the repo's RELEASING.md).

Install

pip install mailwoman-client

Requires Python 3.10+. The only runtime dependencies are httpx and attrs.

Usage

Forward-geocode against the hosted Photon trial endpoint (https://photon.sister.software, no local server needed):

from mailwoman_client import PhotonClient
from mailwoman_client.photon.api.geocoding import search

client = PhotonClient.hosted()  # or PhotonClient(base_url="http://127.0.0.1:2322") to self-host
result = search.sync(client=client, q="berlin", limit=3)

for feature in result.features:
    lon, lat = feature.geometry.coordinates
    props = feature.properties
    print(f"{props.name} ({props.type_}) — {lat:.4f}, {lon:.4f} [{props.country or '?'}]")

Self-hosting

PhotonClient(), NominatimClient(), LibpostalClient(), and MailwomanClient() default to their local serve ports (2322 / 8080 / 8081 / 3000), so they work out of the box against a self-hosted server (npx @mailwoman/photon serve, mailwoman serve, etc.). Only Photon has a hosted public trial endpoint. Point anywhere with base_url=.

Async

Every endpoint module also exposes an asyncio coroutine alongside sync:

result = await search.asyncio(client=client, q="berlin", limit=3)

License

AGPL-3.0-only OR LicenseRef-Commercial (see the repository).

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

mailwoman_client-6.0.0.tar.gz (58.9 kB view details)

Uploaded Source

Built Distribution

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

mailwoman_client-6.0.0-py3-none-any.whl (119.6 kB view details)

Uploaded Python 3

File details

Details for the file mailwoman_client-6.0.0.tar.gz.

File metadata

  • Download URL: mailwoman_client-6.0.0.tar.gz
  • Upload date:
  • Size: 58.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mailwoman_client-6.0.0.tar.gz
Algorithm Hash digest
SHA256 98af6f278be87a8fe26918d4fb5bbc39c39f69c6a0962909a3a92f2a5949238d
MD5 65f6c45682849723b56c67782801fa22
BLAKE2b-256 431b28001fb8212a2d8d90999a045b1690bc957a70f96ee4b9431f02d4f49850

See more details on using hashes here.

File details

Details for the file mailwoman_client-6.0.0-py3-none-any.whl.

File metadata

  • Download URL: mailwoman_client-6.0.0-py3-none-any.whl
  • Upload date:
  • Size: 119.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mailwoman_client-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ee79cd3486186a3dce02bb66a98702241c6384ba1955192d8cc9e88271c964c
MD5 eb133c5c2ec45500a941f29e8b037c6a
BLAKE2b-256 c8645254f6ed6fe67a188d1b449e3ed05ef2ab813b9b22867f14a24dfa4dd616

See more details on using hashes here.

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