Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ pip install PyBMKG
```python
import asyncio

from bmkg import BMKG
from bmkg.enums import Province
from bmkg import Earthquake, WeatherForecast

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()
async with Earthquake() as earthquake:
latest_earthquake = await earthquake.get_latest_earthquake()
strong_earthquake = await earthquake.get_strong_earthquake()
felt_earthquake = await 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}")

async with WeatherForecast() as weather_forecast:
weather_forecast = await weather_forecast.get_weather_forecast("11.01.01.2001")
print(f"Weather Forecast: {weather_forecast}")

asyncio.run(main())
```

Expand Down
17 changes: 9 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ pip install PyBMKG
```python
import asyncio

from bmkg import BMKG
from bmkg.enums import Province
from bmkg import Earthquake, WeatherForecast

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()
async with Earthquake() as earthquake:
latest_earthquake = await earthquake.get_latest_earthquake()
strong_earthquake = await earthquake.get_strong_earthquake()
felt_earthquake = await 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}")

async with WeatherForecast() as weather_forecast:
weather_forecast = await weather_forecast.get_weather_forecast("11.01.01.2001")
print(f"Weather Forecast: {weather_forecast}")

asyncio.run(main())
```

Expand Down
Loading
Loading