A free and asynchronous weather API wrapper made in Python, for Python.
Project description
python-weather

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 the module.
import python_weather
import asyncio
import os
async def main() -> None:
# Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
# Fetch a weather forecast from a city.
weather = await client.get('New York')
# Fetch the temperature for today.
print(weather.temperature)
# Fetch weather forecast for upcoming days.
for daily in weather:
print(daily)
# Each daily forecast has their own hourly forecasts.
for hourly in daily:
print(f' --> {hourly!r}')
if __name__ == '__main__':
# See https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
# for more details.
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! ❤
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_weather-2.1.0.tar.gz.
File metadata
- Download URL: python_weather-2.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
352dfe73201874914da994989ae5d828b6e9fd10b35379386f89a7ac5a9e75f6
|
|
| MD5 |
a6fad691fedf32b6feac63375e58f191
|
|
| BLAKE2b-256 |
86c7055379b1055c4e98bc3bf75fb7e0e24d1c608d46d37e8ac349accc273230
|
File details
Details for the file python_weather-2.1.0-py3-none-any.whl.
File metadata
- Download URL: python_weather-2.1.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76d80c8a04ff40b35066ef48d67c73b72f947d28c0f1a3eb8bd22720e5a9e63e
|
|
| MD5 |
5c642c3ab08a4802726521e06c1e9833
|
|
| BLAKE2b-256 |
fbf8f1e8bbe74d0528bdf1813742a912f89eba2f2cdb78c7b61d4894d5f403ad
|