BoM Weather API gives Python code typed, async access to Australian Bureau of Meteorology (BoM) data: station observations, 7-day town forecasts, hourly forecasts and weather warnings. It was built for the Bureau of Meteorology integration for Home Assistant, and works in any asyncio application.
Contents
- Features
- Installation
- Quick start
- Data sources
- API reference
- Error handling
- Responsible use
- Development
- Licence and attribution
Features
- Async throughout: built on
aiohttpandaioftp, and accepts your ownaiohttp.ClientSession. - Fully typed: frozen dataclass models, ships
py.typed, and passesmypy --strict. - Tolerates missing data: BoM regularly omits values, such as today's minimum temperature after the morning or today's icon late in the evening. Every field is optional, and a missing value is
Nonerather than an exception. - Built on official feeds: forecasts and observations come from BoM's sanctioned anonymous FTP products.
- Location helpers: find the nearest forecast towns and observation stations to any coordinate.
- Predictable errors: a single exception hierarchy; transport exceptions never leak.
- Tested: 100% line and branch coverage against real BoM responses, on Python 3.12, 3.13, 3.14 and 3.15.
Installation
pip install bom-weather-api
or with uv:
uv add bom-weather-api
Requires Python 3.12 or later, and outbound FTP access (port 21) to ftp.bom.gov.au.
Quick start
import asyncio
from bom_weather_api import BomClient, Coordinate
async def main() -> None:
home = Coordinate(latitude=-27.47, longitude=153.02)
async with BomClient() as client:
# Find the nearest forecast town and observation station.
towns = await client.get_forecast_locations()
town, distance = BomClient.nearest(home, towns, limit=1)[0]
stations = await client.get_stations(town.product_state)
station, _ = BomClient.nearest(town.coordinate, stations, limit=1)[0]
# Fetch current conditions, forecasts and warnings.
observation = await client.get_observation(town.product_state, station.id)
daily = await client.get_daily_forecast(town)
hourly = await client.get_hourly_forecast(town.coordinate)
warnings = await client.get_warnings(town.coordinate, details=True)
today = daily.days[0]
print(f"{town.name} ({distance} km away), station {station.name}")
print(
f"Now: {observation.temperature} °C, feels like {observation.apparent_temperature} °C"
)
print(
f"Today: {today.short_text} Max {today.temp_max} °C, {today.rain_chance}% chance of rain"
)
print(f"{len(hourly.hours)} hourly forecasts, {len(warnings)} active warnings")
asyncio.run(main())
Sharing a session
Pass an existing aiohttp.ClientSession to reuse its connections. The client
never closes a session it did not create.
import aiohttp
async with aiohttp.ClientSession() as session:
client = BomClient(session)
forecast = await client.get_daily_forecast(town)
Data sources
| Data | Source |
|---|---|
| Forecast towns, daily town (précis) forecasts, station observations | BoM's official anonymous FTP data feeds on ftp.bom.gov.au |
| Hourly forecasts, warnings, and the extended text, UV, fire danger and sun times in the daily forecast | The undocumented JSON API behind the BoM app (api.weather.bom.gov.au) |
The FTP products are free to access for non-commercial use. The app API is not
a public BoM service and may change without notice. If its daily extras are
unavailable, get_daily_forecast still returns the FTP forecast without them.
API reference
BomClient
BomClient(
session: aiohttp.ClientSession | None = None,
*,
transport: FileTransport | None = None, # defaults to FtpTransport()
timeout: float = 30.0,
user_agent: str = DEFAULT_USER_AGENT,
)
| Method | Returns | Description |
|---|---|---|
get_forecast_locations() |
list[ForecastLocation] |
Every town BoM issues a forecast for (about 680) |
get_stations(state) |
list[Station] |
Observation stations in a state: NSW, VIC, QLD, SA, WA, TAS or NT (ACT stations are in NSW) |
get_observation(state, station_id) |
Observation |
Latest observation from a station |
get_daily_forecast(location, *, extras=True) |
DailyForecast |
7-day town forecast; extras adds extended text, UV, fire danger and sun times |
get_hourly_forecast(coordinate) |
HourlyForecast |
Hourly forecast for about the next 72 hours |
get_warnings(coordinate, *, details=False) |
list[WeatherWarning] |
Current warnings, excluding cancellations; details adds each warning's full message |
get_warning(warning_id) |
WarningDetails |
The full plain-text message of a warning |
BomClient.nearest(coordinate, items, *, limit=None) |
list[tuple[item, float]] |
Towns or stations sorted by distance in km |
BomClient is an async context manager; close() releases a session the client created itself.
Models
All models are frozen dataclasses exported from bom_weather_api.
| Model | Key fields |
|---|---|
Coordinate |
latitude, longitude, geohash, distance_to() |
ForecastLocation |
aac, name, state, coordinate, timezone, product_state |
Station |
id, name, state, coordinate, wmo_id, observes |
Observation |
temperature, apparent_temperature, dew_point, humidity, pressure, wind_speed, wind_direction, wind_gust, rain_since_9am, observed_at, … |
DailyForecast |
issued_at, next_issue_at, days, now |
DailyForecastDay |
date, temp_max, temp_min, short_text, extended_text, rain_chance, rain_amount_range, uv_index, fire_danger, sunrise, sunset, … |
HourlyForecast / HourlyForecastPoint |
time, temperature, humidity, wind_speed, wind_direction, rain_chance, uv_index, is_night, … |
WeatherWarning / WarningDetails |
id, type, title, phase, issued_at, expires_at, message |
Units are metric: °C, km/h, hPa, mm and km. Times are timezone-aware datetime objects.
Error handling
Every error raised by the client derives from BomError:
BomError
├── BomConnectionError the service could not be reached
│ └── BomTimeoutError the request timed out
├── BomResponseError unexpected HTTP or FTP status (.status)
│ ├── BomNotFoundError unknown station, warning or file
│ └── BomRateLimitError slow down (.retry_after, in seconds)
└── BomParseError the response had an unexpected format
from bom_weather_api import BomError, BomNotFoundError, BomRateLimitError
try:
observation = await client.get_observation("QLD", "040913")
except BomNotFoundError:
... # the station is not reporting; choose another one
except BomRateLimitError as err:
... # retry after err.retry_after seconds
except BomError:
... # any other failure
Responsible use
- The client identifies itself with an honest User-Agent. Please keep one that identifies your application.
- Poll no more often than the data changes: observations update every 10 minutes, and town forecasts a few times a day.
- This library does not use the bom.gov.au website API (
api.bom.gov.au), which blocks automated clients. - The BoM FTP products are free for non-commercial use. For commercial use, see BoM's data services.
Development
git clone https://github.com/tinkerologie/bom-weather-api.git
cd bom-weather-api
uv sync
uv run pytest --cov # tests, 100% coverage required
uv run ruff format . && uv run ruff check . && uv run mypy # format, lint, type-check
uvx bandit --recursive src # security scan
Test fixtures in tests/fixtures/ are real BoM responses captured on
2026-10-28. Releases are published to PyPI from GitHub releases using trusted
publishing; see CHANGELOG.md for the release history.
Licence and attribution
Released under the Apache License 2.0.
Weather data © Commonwealth of Australia, Bureau of Meteorology. This project is not affiliated with or endorsed by the Bureau of Meteorology.
Metadata
Release files for bom-weather-api 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bom_weather_api-0.2.0.tar.gz | 37.4 kB | With provenance | Details for bom_weather_api-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bom_weather_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for bom_weather_api-0.2.0-py3-none-any.whl |
Total release size: 62.1 kB
Release files / bom_weather_api-0.2.0.tar.gz
| Download URL | bom_weather_api-0.2.0.tar.gz |
|---|---|
| Size | 37.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83b5864caf4546315f04d5ca65954ae5243d7364eedb430efccdc3a763746ec6
|
|
BLAKE2b-256 checksum How to use checksums |
911fe0031762e99a3070bc0f7d858a13f7ebd337a04fa5e88375d4b9a9e64f7f
|
| 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 28, 2026.
Transparency logRelease files / bom_weather_api-0.2.0-py3-none-any.whl
| Download URL | bom_weather_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 24.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
075750b6f078db2e21e9e18d42d98ef7fc6a25ce43b335e8279e3ce96c084e77
|
|
BLAKE2b-256 checksum How to use checksums |
5323730d71e3c88413814fe79cbdd825bc4738af60c04b7e5142468c72f7693a
|
| 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 28, 2026.
Transparency logSecurity for bom-weather-api 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
Both files in this release have been uploaded with provenance metadata.
Attestation for bom_weather_api-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 28, 2026.
Transparency logA 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.