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.2.tar.gz (128.1 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.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: air_sviva_api-0.0.2.tar.gz
  • Upload date:
  • Size: 128.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.2.tar.gz
Algorithm Hash digest
SHA256 39ab620c01fb44433561ce91a3b704fd3a646491eb40c358dffeea36fda5527e
MD5 0731a45f450e9f23fe0694a71cf398b4
BLAKE2b-256 f58234f5bef633a71218ff000c2ad93862c61adb2477b85147e69ecc05923796

See more details on using hashes here.

File details

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

File metadata

  • Download URL: air_sviva_api-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a1164c385a121a55e436bdc4598a791ab2db5f74598f8c1fbbe7bc97903f2c0
MD5 bfaeaec2cb2befa0429b58efaabedf36
BLAKE2b-256 cd3d278c13a0781737650ed38e109c92cd71aced233a4f29c6c45154e6ed60cf

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