Skip to main content

A Python wrapper for the Israeli Ministry of Environmental Protection air quality API (air.sviva.gov.il)

Project description

py-air-sviva-api

GitHub Release GitHub Activity License Project Maintenance BuyMeCoffee

Python async API wrapper for the Israeli Ministry of Environmental Protection air quality monitoring system (air.sviva.gov.il).

This library provides a clean, type-safe interface to the Envista air quality API.

Features

  • Async-first — built on aiohttp for non-blocking HTTP
  • Fully typed — all API responses deserialized into dataclass models via mashumaro
  • No login required — the API uses a public token generation endpoint
  • Comprehensive endpoint coverage — regions, stations, pollutants, air quality index, historical averages, and more

Installation

pip install air-sviva-api

Or install directly from the repository:

pip install git+https://github.com/GuyKh/py-air-sviva-api.git

Quick Start (5 lines)

import asyncio, aiohttp
from air_sviva_api.client import SvivaAirClient

async def main():
    async with aiohttp.ClientSession() as s:
        c = SvivaAirClient(s)
        await c.generate_token()
        print(await c.get_stations_latest_index())
asyncio.run(main())

API Methods

Regions & Stations

Method Parameters Description
get_regions() All monitoring regions with stations
get_regions_latest_data(region_ids, hours_back=4) region_ids: list[int], hours_back: int Latest readings per region
get_stations_latest_index(hours_back=24) hours_back: int Latest air quality index
get_station_average(station_id, channel_id=None, from_date=None, to_date=None, timebase=5, from_timebase=5, to_timebase=5) station_id: int, channel_id: int?, from_date: date?, to_date: date?, timebase: int, from_timebase: int, to_timebase: int Historical averages (5-min intervals by default)
get_station_index_fast(station_id, from_date=None, to_date=None) station_id: int, from_date: date?, to_date: date? Fast index data
get_station_missing_days(station_id, days_back=180) station_id: int, days_back: int Missing data dates
get_station_images(station_id) station_id: int Station images
find_nearest_stations(lat, lon, limit=10) lat: float, lon: float, limit: int Nearest stations to coordinates

Reference Data

Method Parameters Description
get_pollutants() All tracked pollutants
get_units() Measurement units
get_data_statuses() Data status codes
get_manual_stations() Manual monitoring stations
get_manual_pollutants() Manual measurement pollutants
get_index_pollutants(index_type) index_type: int Index pollutant factors
get_thresholds() Pollutant thresholds
get_advisories() Active advisories

Config & Metadata

Method Parameters Description
get_config_index() System config
get_index_configuration(index_type) index_type: int Index calculation config
get_station_terminology() Station classifications
get_widget_config() Widget config
get_guest_map_view() Guest map view

Map Layers

| Method | Parameters | Description | |--------|--| | get_layer_mng(platform, access_level) | Map layer management | | get_layer_queries(layer_id) | Layer feature queries | | get_layer_filtered_stations(layer_id) | Filtered stations |

Other

Method Parameters Description
get_server_time() Server time
get_interpolation_mng() Interpolation data
get_vineyard_location(location_id) location_id: int Agricultural weather data

Development

git clone https://github.com/GuyKh/py-air-sviva-api.git
cd py-air-sviva-api
pip install -e ".[dev]"
pytest tests/ -v

Code Quality

ruff check .      # Linting
mypy .            # Type checking
pytest tests/ -v  # Tests

Support

If you find this library useful, consider buying me a coffee

License

MIT License - see LICENSE file for details.


Built with ❤️ for the Israeli air quality monitoring community.

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

air_sviva_api-0.0.1.tar.gz (128.0 kB view details)

Uploaded Source

Built Distribution

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

air_sviva_api-0.0.1-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file air_sviva_api-0.0.1.tar.gz.

File metadata

  • Download URL: air_sviva_api-0.0.1.tar.gz
  • Upload date:
  • Size: 128.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for air_sviva_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3df14f958ce5a683fc07d610957ed13464fb008ad0e45e612cb5a947222fa2fa
MD5 5e9602c47d7d55ab86d839f3b8a5bfca
BLAKE2b-256 b77a09424fdedf7345249278a9a8ffd8c3e13cc0bfe706aa87d10d0c1c75c153

See more details on using hashes here.

File details

Details for the file air_sviva_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: air_sviva_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for air_sviva_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b08cad60222a728142e9b26fe56c3431492669b001485602f8d631dd6fbff521
MD5 d4c9bb96d15dd45f18d0d52abd9dc26f
BLAKE2b-256 0542f04f71cac928ad61329ad346c60751f267010d25b313aa994da22f24caeb

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