accuweather
Python wrapper for getting weather data from AccuWeather API.
API key
To generate API key go to https://developer.accuweather.com/subscriptions and after registration create an app.
How to use package
"""Example of usage."""
import asyncio
import logging
from aiohttp import ClientError, ClientSession
from accuweather import (
AccuWeather,
ApiError,
InvalidApiKeyError,
InvalidCoordinatesError,
RequestsExceededError,
)
LATITUDE = 52.0677904
LONGITUDE = 19.4795644
API_KEY = "xxxxx"
logging.basicConfig(level=logging.DEBUG)
async def main():
"""Run main function."""
async with ClientSession() as websession:
try:
accuweather = AccuWeather(
API_KEY,
websession,
latitude=LATITUDE,
longitude=LONGITUDE,
language="pl",
)
current_conditions = await accuweather.async_get_current_conditions()
forecast_daily = await accuweather.async_get_daily_forecast(
days=5, metric=True
)
forecast_hourly = await accuweather.async_get_hourly_forecast(
hours=12, metric=True
)
except (
ApiError,
InvalidApiKeyError,
InvalidCoordinatesError,
ClientError,
RequestsExceededError,
) as error:
print(f"Error: {error}")
else:
print(f"Location: {accuweather.location_name} ({accuweather.location_key})")
print(f"Requests remaining: {accuweather.requests_remaining}")
print(f"Current: {current_conditions}")
print(f"Forecast: {forecast_daily}")
print(f"Forecast hourly: {forecast_hourly}")
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
How to create a dev environment
git clone https://github.com/bieniu/accuweather.git
cd accuweather
./scripts/setup-local-env.sh
Metadata
Release files for accuweather 5.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| accuweather-5.1.0.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| accuweather-5.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / accuweather-5.1.0.tar.gz
| Download URL | accuweather-5.1.0.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87e7e62760c7afbd217d3fcca358e53765aa000df524ec15a5d17cebb1a28b61
|
|
BLAKE2b-256 checksum How to use checksums |
18391a10df3d41a83a36e4c21e41793e64e1ada4537a1ad4decf28b43cf955dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / accuweather-5.1.0-py3-none-any.whl
| Download URL | accuweather-5.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da048af53e67392e8eb2666822f6f2b5d3d3a0232c88dbc04050678a75e9543c
|
|
BLAKE2b-256 checksum How to use checksums |
4f3639a95e8d93f926ba4bbfd91f9632757e11007ec22509796f1e2523d1bae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|