Skip to main content

Python BMKG API Wrapper

Project description

PyBMKG

Test CodeQL Docs codecov pre-commit security: bandit Checked with mypy Ruff pypi python License: MIT

PyBMKG is an asynchronous Python API wrapper designed to harness the power of BMKG's open data on weather forecasts and earthquake information in Indonesia. Powered by the Meteorology, Climatology, and Geophysics Agency (BMKG), this project aims to streamline access to crucial meteorological and seismic data.

Key Features

  • Asynchronous Operations: Utilizes asyncio and aiohttp for efficient API requests.
  • Data Schema: Built with Python's dataclass for clear and structured data representation.
  • Comprehensive Documentation: Explore detailed documentation for seamless integration and usage.

Installation

pip install PyBMKG

Usage

import asyncio

from bmkg import BMKG
from bmkg.enums import Province

async def main():
    async with BMKG() as bmkg:
        weather_forecast = await bmkg.weather_forecast.get_weather_forecast(Province.ACEH)
        latest_earthquake = await bmkg.earthquake.get_latest_earthquake()
        strong_earthquake = await bmkg.earthquake.get_strong_earthquake()
        felt_earthquake = await bmkg.earthquake.get_felt_earthquake()

        print(f"Weather Forecast: {weather_forecast}")
        print(f"Latest Earthquakes: {latest_earthquake}")
        print(f"Strong Earthquakes: {strong_earthquake}")
        print(f"Felt Earthquakes: {felt_earthquake}")

asyncio.run(main())

Docs

You can start reading the documentation here.

Contributing

We welcome contributions to enhance PyBMKG! Please review our contributing guidelines before getting started.

Acknowledgements

We would like to thank the Meteorology, Climatology and Geophysics Agency (BMKG) for its open data service on weather forecasts and latest earthquake information.

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

pybmkg-2.1.0.tar.gz (17.7 kB view hashes)

Uploaded Source

Built Distribution

pybmkg-2.1.0-py3-none-any.whl (32.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page