Skip to main content

Mapricot for Python

The official Python client for the Mapricot API: address and place search, reverse geocoding, nearby places, routing, and IP geolocation, with 250,000 free requests every month.

pip install mapricot

It needs Python 3.11 or later and has no dependencies.

Quick start

Create a server key in the dashboard and pass it to the client. Keep it out of your source code, for example by reading it from an environment variable as here.

import os

from mapricot import Mapricot

client = Mapricot(os.environ["MAPRICOT_KEY"])

data = client.search("128 SW 3rd Ave, Portland", limit=1)
place = data["results"][0]
print(place["label"], place["lat"], place["lon"])

Methods

Each method returns the API's JSON as a typed dict, with the same field names as the API reference.

Method Endpoint
client.search(q, focus=, country=, limit=, lang=) GET /v1/search
client.autocomplete(q, focus=, country=, limit=, lang=) GET /v1/autocomplete
client.reverse(lat, lon, limit=, lang=) GET /v1/reverse
client.nearby(lat, lon, category=, radius=, limit=, lang=) GET /v1/nearby
client.place(id, lang=) GET /v1/places/{id}
client.route(waypoints, mode=) POST /v1/route
client.ip(address) GET /v1/ip/{ip}
client.account() GET /v1/account, which checks a key and is never billed

focus and each waypoint are {"lat": …, "lon": …}. country and category take a list or a comma-separated string.

nearby = client.nearby(45.52, -122.68, category=["food:coffee_shop"], radius=1000)
route = client.route([{"lat": 45.5189, "lon": -122.6793}, {"lat": 45.5214, "lon": -122.6828}], mode="walk")
print(route["routes"][0]["durationSeconds"])

A route's polyline is encoded with six decimal places. Decode it with precision 6, as decoding a route polyline shows.

If your app shows results, show the credits in each response's attribution.

Errors and retries

An error response raises MapricotError, with the HTTP status, the API's error code, a message, and the request_id:

from mapricot import MapricotError

try:
    client.search("")
except MapricotError as error:
    print(error.status, error.code, error.message)  # 400 invalid_request The service rejected the request.

The client retries 503 responses and 429 concurrency_exceeded, up to twice, waiting longer each time. Errors aren't billed. Set max_retries= and timeout= (seconds) on Mapricot(...) to change this. The API reference lists every status.

Metadata

Release files for mapricot 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mapricot 0.2.0
File Size Uploaded Provenance
mapricot-0.2.0.tar.gz 7.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mapricot 0.2.0
File Interpreter ABI Platform
mapricot-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / mapricot-0.2.0.tar.gz

Download URL mapricot-0.2.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4f38b7bc494e11fe5a58ff9e9bbda44c8671f67eddc8691582cd2f8f3a9e368a
BLAKE2b-256 checksum
How to use checksums
01c433d3ed5795c97810f249eb25783bf42c36e8bdc69c0f2ac57426372d1252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Release files / mapricot-0.2.0-py3-none-any.whl

Download URL mapricot-0.2.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d98e8c22a6ce33ed34aeac6c098ba8e69381a8d0f846b37c94c7cdea1604a81
BLAKE2b-256 checksum
How to use checksums
f429bc1a4c21fe1fe32e33face5fd3416e5e83573a822a90cc4bb8980b08c993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Security for mapricot 0.2.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mapricot-0.2.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 Oct 25, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page