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.3.tar.gz (133.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.3-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: air_sviva_api-0.0.3.tar.gz
  • Upload date:
  • Size: 133.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.3.tar.gz
Algorithm Hash digest
SHA256 d703591450689f880fbe31db39f9f4dce4ecafb8710c3fb3552b5be721170ba7
MD5 25a1911333292aeeadaa8f3990dbdbe8
BLAKE2b-256 70be1335e6a23ad4fb33d2bc58943022b250d03492e6b7c1a670feb434cb1d74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: air_sviva_api-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 67a5276541d51b9351a4468273b7333f6043148c7f19b1d2f8e51d2bf29107cb
MD5 0cf05158b672089f5730c133578c541b
BLAKE2b-256 87c4b933026e39c721248cf3185de62fe00742ece3b3bd839f15f0f18505a944

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