API
bmkg.api
Earthquake
Bases: API
Earthquake API Wrapper from BMKG API.
get_felt_earthquake()
async
Request felt earthquake from earthquake API.
Returns:
| Type | Description |
|---|---|
Iterator[FeltEarthquake]
|
An iterator of fifteen |
Examples:
get_latest_earthquake()
async
Request latest earthquake from earthquake API.
Returns:
| Type | Description |
|---|---|
LatestEarthquake
|
A |
Examples:
>>> import asyncio
>>> from bmkg import Earthquake
>>> async def main():
... async with Earthquake() as earthquake:
... latest_earthquake = await earthquake.get_latest_earthquake()
... print(latest_earthquake)
>>> asyncio.run(main())
LatestEarthquake(earthquake=Earthquake(datetime=datetime.datetime(...)
Notes
The LatestEarthquake schema has a shakemap field which is the Shakemap API.
get_strong_earthquake()
async
Request strong earthquake that has magnitude 5.0 above from earthquake API.
Returns:
| Type | Description |
|---|---|
Iterator[StrongEarthquake]
|
An iterator of fifteen |
Examples:
Shakemap
Bases: API, Shakemap
Shakemap API Wrapper from BMKG API.
get_content()
async
Get the shakemap file content.
Returns:
| Type | Description |
|---|---|
bytes
|
A bytes of |
Examples:
>>> import asyncio
>>> from bmkg import Earthquake
>>> async def main():
... async with Earthquake() as earthquake:
... latest_earthquake = await earthquake.get_latest_earthquake()
... shakemap = latest_earthquake.shakemap
... shakemap_content = await shakemap.get_content()
... print(shakemap_content)
>>> asyncio.run(main())
b'...'
WeatherForecast
Bases: API
Weather Forecast API Wrapper from BMKG API.
get_weather_forecast(region_code)
async
Request weather forecast from weather forecast API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region_code
|
str
|
The administrative region code (level IV) for a subdistrict or village in Indonesia. The code is formatted as |
required |
Returns:
| Type | Description |
|---|---|
WeatherForecast
|
A |
Examples:
>>> import asyncio
>>> from bmkg import WeatherForecast
>>> async def main():
... async with WeatherForecast() as weather_forecast:
... weather_forecast_data = await weather_forecast.get_weather_forecast(
... "11.01.01.2001"
... )
... print(weather_forecast_data)
>>> asyncio.run(main())
WeatherForecast(location=Location(admin_level_1=...)