A free and asynchronous weather Python API wrapper made in Python, for Python.
Getting started
Run the following command in your terminal:
$ pip install python-weather
Example
For more information, please read the documentation.
import python_weather
import asyncio
import os
async def main() -> 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(main())
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! ❤
