Skip to main content

aportee

A Python client and command-line tool for the à portée access API for Canada: walking, cycling and transit minutes to everyday amenities at any point, place and amenity search, reference datasets, map images and embeds.

Every CLI command has a --json mode that prints the API payload, and an exit code that maps to the HTTP status, so a script or coding agent can branch on it without parsing text.

Documentation: aportee.ca/dev/tools/cli and the API reference.

Install

Needs Python 3.11 or later. It has no dependencies outside the standard library.

pipx install aportee        # the aportee command
uvx aportee access 43.25085 -79.81809   # or run it without installing
pip install aportee         # the Python client in a project

Keys

Most read calls work without a key (100 requests a day per IP address). A free key raises the limit to 1,000 a day and unlocks batch lookups, map images, walking routes, the name search near a point, and transit at other periods, at p90 (the worst case) or by bike + transit. aportee login gets one: it prints a link and a code and opens your browser, where you sign in and approve. It then prints export APORTEE_API_KEY=… (the key is shown once). --name sets the name shown on the approval page. You can also sign in and choose Create a key on your account page.

eval "$(aportee login)"                  # or copy the export line it prints
export APORTEE_API_KEY=ap_...            # or pass --key <k>
export APORTEE_BASE=https://aportee.ca   # another deployment (or --base)

Command line

Command What it does
aportee access <lat> <lon> Minutes to each amenity type from a point. --mode walk|bike|transit|combo (default walk; combo is bike + transit), and for transit --period weekday_peak|weekday_night|saturday_midday|sunday_midday and --statistic p50|p90. --include minutes,population,place,narrative,walk_counts (or all), --types grocery,pharmacy, --lang en|fr, --walk-minutes 5-55 for walk_counts.
aportee describe <lat> <lon> Just the generated walkability narrative. --lang en|fr.
aportee where <lat> <lon> Nearest populated place.
aportee find <name> Place search. Add --near <lat,lon> (keyed) to also search, by name, the POIs reached on foot from there; --walk-minutes sets how far (default 15).
aportee compare <lat,lon> <lat,lon> Per-type minutes delta between two points. --types, --mode, --period, --statistic.
aportee routes <lat> <lon> --types grocery,school The walked path to the nearest place of each of 1–5 types, routed live (keyed; each type routed counts as one request).
aportee compass <lat> <lon> Each everyday trip's nearest place, its minutes and its direction, and the next places. --types.
aportee batch <file.csv|-> Batch lookups from lat,lon CSV rows (keyed). --format json|geojson, --mode, --period, --statistic.
aportee image <lat> <lon> Branded map PNG (keyed). --out FILE, --zoom --types --theme --lang -w -h, --markers-file FILE (your own points, up to 500: a CSV of lat,lon[,label] or a GeoJSON FeatureCollection).
aportee embed <lat> <lon> iframe snippet. --zoom --types --theme --lang -w -h --dots 0, --markers-file FILE (up to 20 points, without labels).
aportee amenities Every amenity type with English and French labels.
aportee reference [canale|sam] Can-ALE and Spatial Access Measures records. --id, --mode.
aportee me The key's tier, today's limit and what is left. Not counted against the limit.
aportee login Get a free API key by approving it in your browser. --name.

access, describe, where, routes, compass, image, embed and reference also accept --place "<name>" instead of <lat> <lon>. It takes the centre of the first town matching that name (no street addresses). Global flags: --json, --key <k>, --base <url>, --help.

aportee access 43.25085 -79.81809 --include all
aportee access 45.5017 -73.5673 --mode transit --types grocery,pharmacy
aportee describe --place "Kitchener"
aportee find "Fickle Fig" --near 48.43,-123.37
aportee compare 43.25,-79.82 43.65,-79.38 --types grocery,pharmacy
aportee routes 43.25085 -79.81809 --types grocery,school
aportee compass 43.25085 -79.81809
aportee image --place Hamilton --out hamilton.png
aportee image 53.5465 -113.555 --zoom 15 --markers-file permits.csv --out permits.png
aportee reference sam 43.25 -79.82 --mode walking

Exit codes

Code Meaning
0 success
2 bad input (400 / 422, or bad arguments)
3 no data (204)
4 outside coverage (404)
5 rate limited (429)
1 anything else: no key (401), network, 5xx

Python

from aportee import Client

client = Client()  # reads APORTEE_API_KEY; Client(key="ap_...") also works

# One point needs no key and returns a dict.
snapshot = client.access((43.25085, -79.81809), types=["grocery", "pharmacy"])
print(snapshot["minutes"]["grocery"])  # {'value': 6, 'reason': 'ok'}

# A list of points is sent 100 at a time (keyed) and returns a list in the same order.
results = client.access([(43.25, -79.82), (43.65, -79.38)], include="minutes")

client.amenities()  # [{'type': 'grocery', 'label': {...}}, ...]
client.search("Hamilton")  # {'places': [...]}
client.reference("canale", id="35250773")
client.routes((43.25085, -79.81809), ["grocery", "school"])  # GeoJSON, keyed
client.compass((43.25085, -79.81809))  # {'cell': ..., 'trips': [...], 'meta': ...}
client.me()  # your tier and what is left of today's limit

# A map image with your own points on it (keyed): up to 20 pairs go in the query, more
# (up to 500), labels or a GeoJSON FeatureCollection are sent as a POST.
png = client.image(53.5465, -113.555, zoom=15, markers=[(53.5465, -113.555, "Permit 1")])

Results are plain dicts and lists. With pandas installed, to_frame flattens them into a DataFrame with dotted columns such as minutes.grocery.value:

from aportee import to_frame

frame = to_frame(results)

A failed call raises aportee.ApiError with status, code and detail. Client().login() runs the same browser sign-in as aportee login and keeps the new key on the client.

Development

cli/ is its own uv project, separate from the repository's root Python project (the data pipeline). Inside the root venv, the aportee command is the pipeline's; run the client with uv run --project cli aportee. From the repository root:

uv sync --project cli
uv run --project cli aportee access 43.25 -79.82 --base http://localhost:4321
uv run --project cli pytest cli
uv run --project cli ruff check cli && uv run --project cli ruff format --check cli
uv run --project cli ty check --project cli

Releases are published to PyPI by .github/workflows/publish-python.yml when a py-v* tag is pushed; the tag must match version in cli/pyproject.toml.

Metadata

Release files for aportee 0.1.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 aportee 0.1.0
File Size Uploaded Provenance Actions
aportee-0.1.0.tar.gz 20.6 kB Without provenance Details for aportee-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 43.5 kB

Release files / aportee-0.1.0.tar.gz

Download URL aportee-0.1.0.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
798b0ba910a8811e5d9d44029f6e6be4bf4d3094d282bf9e8a187b469507f4fa
BLAKE2b-256 checksum
How to use checksums
8d3ebbbc49b898a480f2a2a53b9970a63a213617b1435a3ced1fb54486a3d727
Upload date
Uploaded using Trusted Publishing?
What is 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":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / aportee-0.1.0-py3-none-any.whl

Download URL aportee-0.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8355205e65c85192756028544c0f3759575ff8237a9c43a7ecf3dd85b98a7860
BLAKE2b-256 checksum
How to use checksums
325f2c52dfddb81db0b36636c86d3cf053bd17f9293a0c9fb5121de20a6c222c
Upload date
Uploaded using Trusted Publishing?
What is 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":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for aportee 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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