Skip to main content

Python client for the Beach Day API — real-time beach and surf conditions

Project description

Beach Day API — Python Client

PyPI version Python License: MIT

Python client for the Beach Day API — water quality, weather, tides, ocean conditions, beach rules, amenities, and composite scoring in a single call. Covers 5,300+ beaches across the US, Australia, South Africa, Spain, Cambodia, Thailand, Vietnam, and China.

pip install beachdayapi

Quick Start

from beachdayapi import BeachDayAPI

client = BeachDayAPI("bda_your_api_key")

# Search beaches by state (supports offset/limit pagination)
beaches = client.beaches.list(state="CA")
# Pagination: client.beaches.list(state="CA", offset=100, limit=50)
# Filter by country: client.beaches.list(country="Cambodia")
for b in beaches["data"]:
    print(b["name"], b["state"])

# Search beaches by name
malibu = client.beaches.list(search="Malibu")
print(f"Found {malibu['count']} beaches matching 'Malibu'")

# Get full detail for a beach
beach = client.beaches.get(372)
print(beach["data"]["name"], beach["data"]["beach_day_score"])

# Get current conditions (supports offset/limit)
conditions = client.beaches.conditions(372)
# Pagination: client.beaches.conditions(372, offset=30, limit=15)
print(conditions["data"]["water_quality_grade"])

# Get top-scored beaches (supports offset/limit)
scored = client.beaches.scored(min_score=70, limit=10)
# Pagination: client.beaches.scored(offset=50, limit=25)
for b in scored["data"]:
    print(f"{b['name']}: {b['beach_day_score']}")

# Discover available countries
countries = client.beaches.countries()
for c in countries["results"]:
    print(f"{c['country']}: {c['beach_count']} beaches")

# Health check (no API key needed)
health = client.health()
print(health)

API Key

Sign up at beachdayapi.com to get your free API key (50 free credits, no credit card). Your key starts with bda_.

You can also set the BEACHDAY_API_KEY environment variable:

import os
from beachdayapi import BeachDayAPI

client = BeachDayAPI(os.environ["BEACHDAY_API_KEY"])

Endpoints

Method Endpoint Cost Description
client.health() GET /v1/health Free API health check
client.beaches.list() GET /v1/beaches 1 credit Search beaches
client.beaches.get(id) GET /v1/beaches/{id} 5 credits Beach detail
client.beaches.conditions(id) GET /v1/beaches/{id}/conditions 3 credits Current conditions
client.beaches.scored() GET /v1/beaches/scored 10 credits Scored beaches
client.beaches.countries() GET /v1/countries 1 credit List countries with counts

Error Handling

from beachdayapi import (
    BeachDayAPI,
    AuthenticationError,
    InsufficientCreditsError,
    NotFoundError,
    RateLimitError,
    ServerError,
)

client = BeachDayAPI("bda_invalid_key")

try:
    client.beaches.list(state="CA")
except AuthenticationError:
    print("Check your API key")
except InsufficientCreditsError:
    print("Buy more credits at beachdayapi.com/credits/pricing/")
except RateLimitError:
    print("Slow down")

Requirements

  • Python 3.9+
  • Zero dependencies (stdlib only)

License

MIT — see the main Beach Day API repository.

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

beachdayapi-0.1.4.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

beachdayapi-0.1.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file beachdayapi-0.1.4.tar.gz.

File metadata

  • Download URL: beachdayapi-0.1.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for beachdayapi-0.1.4.tar.gz
Algorithm Hash digest
SHA256 094f148f32b08a02099f2c1eb6b69f8c9e4aed9d462c40a86dd94b7f2cfdb7a1
MD5 099b5b73512022b50d469f9f82627d71
BLAKE2b-256 5ee07ce0f448e186a6ebc1aac61fc8ff56d949c66e0f68b706ac4b8fce63f70a

See more details on using hashes here.

File details

Details for the file beachdayapi-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: beachdayapi-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for beachdayapi-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cfe82ff7f1882141cb649e228d0687c9886c509db00a669e894df00d88253654
MD5 955a0f67c81dab9d8760518e1102896c
BLAKE2b-256 124a7e8a37e018cf6f5bd1f548a84b8307c788cd2088df5e36824463b55cf40b

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