geomelon
Python client for the Geomelon API — cities, countries, regions, and languages with multilingual support (50+ languages).
- Zero dependencies — standard library only (
urllib) - Python 3.8+ — tested on 3.8 through 3.14
- Fully typed — dataclass models,
py.typedmarker, works with mypy/pyright - Sync API, one sub-client per resource, mirroring the TypeScript client
Install
pip install geomelon
Try it — no API key needed
City autocomplete via the free oneshot endpoint, zero signup:
from geomelon import GeomelonClient
client = GeomelonClient() # no key
for city in client.oneshot.search("es", "es", "barc"):
print(city.name, city.population, city.emoji)
# Barcelona 1620343 🇪🇸
search(iso, lang, prefix) takes an ISO 3166-1 alpha-2 country code, a BCP 47 language code, and the city-name prefix as the user typed it — the server normalizes case, punctuation, and diacritics ("Sant Cugat", "barç", and "barc" all work). Everything else (full-text search, filters, coordinates, countries, regions, translations) requires an API key.
Quickstart
Get an API key from RapidAPI.
from geomelon import GeomelonClient
client = GeomelonClient(api_key="YOUR_RAPIDAPI_KEY")
# Prefix search with multilingual names
cities = client.cities.search(name="barc", country_code="ES", preferred_languages="es,en")
for city in cities:
print(city.name, city.population, city.country_emoji)
# Barcelona 1620343 🇪🇸
# Single city by UUID
barcelona = client.cities.get("964512d1-f150-4876-87ec-0ba47aef694a")
print(barcelona.time_zone) # Europe/Madrid
print(barcelona.translations[0]) # CityTranslation(language='es', name='Barcelona')
# Nearest cities to coordinates
nearby = client.cities.by_coordinates_closest(41.3828, 2.1769, preferred_languages="es")
# Countries, regions, languages
spain = client.countries.get("a1e06cc1-817c-429f-84f4-6ab51dac9bfa")
print(spain.iso_code, len(spain.regions))
# Distance between two cities (km)
dist = client.cities.distance(city1="<uuid-1>", city2="<uuid-2>")
print(dist.distance_km)
# Oneshot: pre-built static prefix search (fastest path)
results = client.oneshot.search("es", "es", "ba")
With an API key, oneshot requests route through the RapidAPI gateway and count toward your plan. Pass free_oneshot=True to send them to the free keyless host instead:
client = GeomelonClient(api_key="YOUR_RAPIDAPI_KEY", free_oneshot=True)
API surface
| Sub-client | Methods |
|---|---|
client.cities |
search, get, translations, settlement_types, distance, by_coordinates_closest, by_coordinates_largest |
client.countries |
list, get, translations, regions |
client.regions |
list, get, translations |
client.languages |
list, get |
client.oneshot |
search |
All method parameters are keyword arguments in snake_case; they map 1:1 to the API's camelCase query parameters (country_code → countryCode). None parameters are omitted from the request. Response models are dataclasses with snake_case fields; unknown response fields are ignored, so API additions never break older client versions.
Error handling
All failures raise GeomelonError:
from geomelon import GeomelonClient, GeomelonError
client = GeomelonClient(api_key="YOUR_RAPIDAPI_KEY")
try:
client.cities.search(name="barc")
except GeomelonError as err:
if err.is_rate_limited: # HTTP 429
...
print(err.status, err.body, err.url)
status is None for network-level failures (DNS, timeout, connection refused).
Configuration
GeomelonClient(
api_key="...", # optional; omit for free-oneshot-only mode
host="geomelon.p.rapidapi.com", # override for staging/custom gateways
timeout=30.0, # seconds, per request
free_oneshot=False, # route oneshot to the keyless host even with a key
)
Calling a keyed endpoint on a keyless client raises GeomelonError immediately (no network request) with a message pointing to the RapidAPI signup.
Development
python -m unittest discover -s tests -v # run tests (no dev dependencies needed)
python -m build # build sdist + wheel (pip install build)
Publishing runs through GitHub Actions with PyPI trusted publishing on GitHub release — see .github/workflows/publish.yml.
License
MIT
Metadata
Release files for geomelon 1.0.0
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 | Actions |
|---|---|---|---|---|
| geomelon-1.0.0.tar.gz | 10.4 kB | With provenance | Details for geomelon-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geomelon-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for geomelon-1.0.0-py3-none-any.whl |
Total release size: 19.9 kB
Release files / geomelon-1.0.0.tar.gz
| Download URL | geomelon-1.0.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a0e7067cc4f5e9719c49a9ceccc659d54f7038a989d309e6a630b4d06e5a600
|
|
BLAKE2b-256 checksum How to use checksums |
63c995a88d7ced16cc0e081a41357cec81a669dd548a4554564747447a6f3a43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.
Transparency logRelease files / geomelon-1.0.0-py3-none-any.whl
| Download URL | geomelon-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d05e0f4466c1c5cb2ff39ed5b809222674d3fddd1d96ddce2a27c57dda8f5a38
|
|
BLAKE2b-256 checksum How to use checksums |
8adefcb437b1321ea5eda637403c9ffbea2b1870dfab013d10cdc54ad45e5f07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.
Transparency logSecurity for geomelon 1.0.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for geomelon-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.