A free and asynchronous weather Python API wrapper made in Python, for Python.
Installation
pip install python-weather
Example
For more information, please read the documentation.
import python_weather
import asyncio
import os
async def getweather() -> None:
async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
weather = await client.get('New York')
print(weather.temperature)
for daily in weather:
print(daily)
for hourly in daily:
print(f' --> {hourly!r}')
if __name__ == '__main__':
if os.name == 'nt':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(getweather())
Data source
This library depends on wttr.in
, which uses data from the World Weather Online API.
Donations
If you want to support this project, consider donating! ❤