Skip to main content

Python SDK for the Boring API — U.S. building permit data

Project description

boringapi

Python SDK for the Boring API — U.S. building permit data. One API.

pip install boringapi

Quick start

from boringapi import BoringAPI

client = BoringAPI("bp_live_sk_...")

# List permits
permits = client.permits.list(state="CA", limit=10)
for permit in permits.data:
    print(permit.id, permit.status, permit.address.full)

# Get a single permit
permit = client.permits.get("pmt_abc123")

# Search
results = client.permits.search("solar panel installation")

# Nearby permits
nearby = client.permits.nearby(latitude=37.7749, longitude=-122.4194, radius_miles=0.5)

# Bulk fetch
permits = client.permits.bulk(["pmt_abc123", "pmt_def456"])

client.close()

Auto-pagination

Iterate through all results automatically:

for permit in client.permits.auto_paging_iter(state="CA", status="issued"):
    print(permit.permit_number)

Jurisdictions

jurisdictions = client.jurisdictions.list(state="CA")
jurisdiction = client.jurisdictions.get("jur_san_francisco")

Account

account = client.accounts.me()
usage = client.accounts.usage()

API keys

keys = client.keys.list()
new_key = client.keys.create(name="CI Pipeline")
print(new_key.key)  # Only shown once
client.keys.revoke("key_abc123")

Webhooks

webhook = client.webhooks.create(
    url="https://example.com/webhook",
    events=["permit.created", "permit.status_changed"],
)
print(webhook.secret)  # Save this for signature verification

webhooks = client.webhooks.list()
deliveries = client.webhooks.deliveries(webhook.id)
client.webhooks.delete(webhook.id)

Context manager

with BoringAPI("bp_live_sk_...") as client:
    permits = client.permits.list(state="TX")

Error handling

from boringapi._exceptions import NotFoundError, RateLimitError

try:
    permit = client.permits.get("pmt_nonexistent")
except NotFoundError as e:
    print(e.message)
except RateLimitError:
    print("Slow down!")

Configuration

client = BoringAPI(
    "bp_live_sk_...",
    base_url="https://api.boringapi.dev/v1",  # default
    timeout=30.0,                               # seconds, default
)

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

boringapi-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

boringapi-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file boringapi-0.1.0.tar.gz.

File metadata

  • Download URL: boringapi-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for boringapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 69a6f798fa1188317d37786574b6333b08be6e8c20a4ee007472623cb2b12d50
MD5 b588b1f6b22b53cde53e2802d1729ec8
BLAKE2b-256 50da4ba074facb655a38f0b1f0fadfedcde959ce9b8b980777628f2d8090f4dc

See more details on using hashes here.

File details

Details for the file boringapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: boringapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for boringapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f33ca20cbe90456bececf06396e246639e5e175abdd91b56f65d5760abe1b78f
MD5 9316a805feee8053bb84b7efa66ef7a6
BLAKE2b-256 e950b219b478e652199cf20fc3c6883a9294c8cbafb4ca8fa176d7eb37cbd9fc

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