Skip to main content

pyforeca

CI Python 3.12+ License: MIT

Async Python client for the Foreca Weather API — current conditions, hourly and daily forecasts, air quality and location lookup, with typed models and aiohttp under the hood.

Getting an API key

Create a free account at developer.foreca.com, pick a plan (the Freemium plan is free forever), and copy your key from My API.

Install

pip install pyforeca

Not on PyPI yet — until the first release, install from source: pip install git+https://github.com/foreca-dev/pyforeca.git

Usage

import asyncio
from pyforeca import ForecaApiClient, format_location

async def main() -> None:
    async with ForecaApiClient("YOUR_API_KEY") as client:
        location = format_location(lon=24.94, lat=60.17)

        current = await client.current(location)
        print(current.temperature, current.symbol_phrase)

        daily = await client.forecast_daily(location, periods=7)
        hourly = await client.forecast_hourly(location, periods=24)
        air_quality = await client.air_quality_hourly(location, periods=1)

asyncio.run(main())

Pass an existing aiohttp.ClientSession as session= to share one with your application; the client then leaves closing it to you.

Method Endpoint
location_info(location) /api/v1/location/{location}
current(location) /api/v1/current/{location}
forecast_hourly(location, periods, dataset) /api/v1/forecast/hourly/{location}
forecast_daily(location, periods, dataset) /api/v1/forecast/daily/{location}
air_quality_hourly(location, periods) /api/v1/air-quality/forecast/hourly/{location}
air_quality_daily(location, periods) /api/v1/air-quality/forecast/daily/{location}

location is "longitude,latitude" (longitude first) or a Foreca location id. Symbol.parse("d421") decodes weather symbol codes; see the symbol reference.

Errors: ForecaAuthError (key rejected), ForecaRateLimitError (HTTP 429), ForecaConnectionError (network/timeout), all subclasses of ForecaError.

Attribution

Applications displaying Foreca data must attribute Foreca — see the logo and attribution requirements.

Development

python3 -m venv .venv && .venv/bin/pip install -e . pytest pytest-asyncio
.venv/bin/pytest

Maintained by Foreca in the foreca-dev organization. Released under the MIT License.

Release files for pyforeca 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyforeca 0.1.0
File Size Uploaded
pyforeca-0.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyforeca 0.1.0
File Interpreter ABI Platform
pyforeca-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / pyforeca-0.1.0.tar.gz

Download URL pyforeca-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c713cabb42f4451ee266cc0d715ef47223503024f569209b5d0af80439e56562
BLAKE2b-256 checksum
How to use checksums
7875d8b4d84a7386c1286d85621e5f2453ddcbc9732ba665655769afb771e924
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 3, 2026.

Transparency log

Release files / pyforeca-0.1.0-py3-none-any.whl

Download URL pyforeca-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28fb9493f3712c0c0bb85986db1b37195aa4d7906578e636deb0d5d59872e981
BLAKE2b-256 checksum
How to use checksums
9cb87ef36b6724bdf0982e0ff25e5ad1f2993143d9aa88477dc2638416b4ce27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page