Registry / http-networking / openmeteo-sdk

openmeteo-sdk

JSON →
library1.26.0pypypiunverified

The Open-Meteo Python SDK provides FlatBuffer data models for interacting with the Open-Meteo weather API. It allows developers to construct API requests and parse API responses using highly efficient binary serialization. The library is actively maintained with frequent updates (often monthly or bi-monthly) to support new weather models and variables as the Open-Meteo API evolves.

pip install openmeteo-sdk
INSTALL
IMPORT
SIG · OPENMETEO-SDK
O
openmeteo-sdk
http-networkingpythonv1.26.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.26.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WeatherApiRequest
from openmeteo_sdk import WeatherApiRequest
from openmeteo_sdk import WeatherApiRequest

This quickstart demonstrates how to use `openmeteo-sdk` to build a FlatBuffer request for weather data, send it to the Open-Meteo API using the `requests` library, and then parse the binary FlatBuffer response to extract hourly temperatures and daily sunshine duration. It highlights the use of `flatbuffers.Builder` for request creation and direct access to data via the generated `WeatherApiResponse` classes.

import requests import flatbuffers from openmeteo_sdk.WeatherApiRequest import WeatherApiRequest from openmeteo_sdk.WeatherApiResponse import WeatherApiResponse from openmeteo_sdk.Variables import Variables def get_weather_data(latitude: float, longitude: float): builder = flatbuffers.Builder(0) request = WeatherApiRequest.WeatherApiRequest.StartWeatherApiRequest(builder) WeatherApiRequest.WeatherApiRequest.AddLatitude(request, latitude) WeatherApiRequest.WeatherApiRequest.AddLongitude(request, longitude) WeatherApiRequest.WeatherApiRequest.AddHourly(request, Variables.Variables().TEMPERATURE_2M) WeatherApiRequest.WeatherApiRequest.AddDaily(request, Variables.Variables().SUNSHINE_DURATION) WeatherApiRequest.WeatherApiRequest.AddTimezone(request, builder.CreateString("Europe/Berlin")) request_object = WeatherApiRequest.WeatherApiRequest.EndWeatherApiRequest(builder) builder.Finish(request_object) # Send request to Open-Meteo API response = requests.post( "https://api.open-meteo.com/v1/forecast?models=gfs_seamless", data=builder.Output(), headers={ "Content-Type": "application/flatbuffers", "Accept": "application/flatbuffers" } ) response.raise_for_status() # Parse response weather_api_response = WeatherApiResponse.WeatherApiResponse.GetRootAsWeatherApiResponse(response.content) # Access hourly data if weather_api_response.Hourly() is not None: hourly_temperatures = [] for i in range(weather_api_response.Hourly().VariablesLength()): variable = weather_api_response.Hourly().Variables(i) if variable.Variable() == Variables.Variables().TEMPERATURE_2M: for j in range(variable.ValuesLength()): hourly_temperatures.append(variable.Values(j)) print(f"Hourly Temperatures (2m): {hourly_temperatures[:5]}...") # Print first 5 for brevity # Access daily data if weather_api_response.Daily() is not None: daily_sunshine = [] for i in range(weather_api_response.Daily().VariablesLength()): variable = weather_api_response.Daily().Variables(i) if variable.Variable() == Variables.Variables().SUNSHINE_DURATION: for j in range(variable.ValuesLength()): daily_sunshine.append(variable.Values(j)) print(f"Daily Sunshine Duration: {daily_sunshine[:5]}...") # Print first 5 for brevity if __name__ == '__main__': get_weather_data(latitude=52.52, longitude=13.41)
Debug
Known issues
gotchaThe `openmeteo-sdk` primarily provides FlatBuffer data models (schemas and generated classes) for constructing API requests and parsing responses. It does NOT include an HTTP client. You must use a separate library like `requests` to send the serialized FlatBuffer request and receive the binary response.
fix
Always import and use an HTTP client (e.g., `import requests`) to handle the network communication with the Open-Meteo API.
affects: All versions
gotchaAccessing data from the `WeatherApiResponse` and other FlatBuffer objects requires specific methods (e.g., `Hourly()`, `Variables(i)`, `Values(j)`, `Variable()`) rather than direct attribute access. This is due to the FlatBuffers design for efficient memory access.
fix
Refer to the generated class methods (e.g., `response.Hourly().Variables(0).Values(0)`) as shown in the quickstart or SDK examples to correctly retrieve data fields. Use `Length()` methods for iteration.
affects: All versions
gotchaThe Open-Meteo API is highly configurable. Requesting variables or models that are incompatible or unavailable for a given latitude/longitude or time range can result in empty data arrays in the response without an explicit error from the SDK itself. The SDK will simply parse what the API returns.
fix
Always check the Open-Meteo API documentation for available variables, models, and parameters for your specific use case. Validate the contents of `response.Hourly().VariablesLength()` or `response.Daily().VariablesLength()` to ensure data was received as expected.
affects: All versions
Upgrade
Version history
1.26.0latest on PyPI · released Mar 21, 2026
Audit
Dependencies
flatbuffersrequiredCore library for efficient serialization and deserialization of API requests and responses based on the FlatBuffers schema.
requestsoptionalCommonly used for making HTTP calls to the Open-Meteo API, as the SDK only provides data models, not an HTTP client itself.
Agent activity
15 hits · last 30 days
node
14
Resources
openmeteo-sdk — pip install openmeteo-sdk · libregistry