Python SDK
closecity is a typed Python client over the Close API. By default it returns a
geopandas.GeoDataFrame where geometry applies (points, isochrones, and block
polygons) and a plain pandas.DataFrame otherwise.
pip install closecityQuickstart
Section titled “Quickstart”from closecity import Client
# Your API key (ck_live_) is created at https://account.close.city.close = Client("ck_live_your_key_here")
# Catalog routes are free and come back as data frames.types = close.destination_types()
# A radius search returns a GeoDataFrame of points, ready to map.groceries = close.pois_search(lat = 41.82, lon = -71.41, radius_m = 1500)groceries.plot()Choosing an output
Section titled “Choosing an output”Set output on the client, or per call:
output = "spatial"(the default) returns aGeoDataFramewhere geometry applies and aDataFrameotherwise.output = "tabular"returns a plainDataFramefor every route and never downloads block boundaries. This is the cheap path when you only want numbers.output = "raw"returns the underlyingReply/Paginator, with.tokens_charged,.etag, and the parsed body on.data.
close.output = "raw"summary = close.block_summary("440070008001068", mode = "walk")print(summary.tokens_charged, "charged;", summary.tokens_remaining, "left")Metering and envelope metadata ride on df.attrs in the frame modes.
Full documentation
Section titled “Full documentation”The Python SDK documentation has installation notes, a guided tour, worked tutorials, and the complete API reference. The API reference here documents every endpoint and response shape.