Python wrapper for getting weather data from AccuWeather servers.
Project description
accuweather
Python wrapper for getting weather data from AccuWeather servers for Limited Trial package.
API key
To generate API key go to https://developer.accuweather.com/user/register and after registration create an app.
How to use package
import asyncio
import logging
from accuweather import (
AccuWeather,
ApiError,
InvalidApiKeyError,
InvalidCoordinatesError,
RequestsExceededError,
)
from aiohttp import ClientError, ClientSession
LATITUDE = 52.0677904
LONGITUDE = 19.4795644
LOCATION_KEY = "268068"
API_KEY = "xxxxx"
logging.basicConfig(level=logging.DEBUG)
async def main():
async with ClientSession() as websession:
try:
accuweather = AccuWeather(
API_KEY, websession, latitude=LATITUDE, longitude=LONGITUDE
)
current_conditions = await accuweather.async_get_current_conditions()
forecast = await accuweather.async_get_forecast(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}")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
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
accuweather-0.3.0.tar.gz
(9.4 kB
view details)
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 accuweather-0.3.0.tar.gz.
File metadata
- Download URL: accuweather-0.3.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d32ca6a0be67f3b4fbd8505aad2aad134e45ffdd704423c6624e7c2ace0ec310
|
|
| MD5 |
321a427080f4004068689aab6f2daaea
|
|
| BLAKE2b-256 |
74c69fb57b3a0aadb46a523803b257c842db5631aa4e4c0ecfeb619ba6278325
|
File details
Details for the file accuweather-0.3.0-py3-none-any.whl.
File metadata
- Download URL: accuweather-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ad6481232e8d3f3792472f785941ccc8cea3274b08e593bfe08d27a7c47efe
|
|
| MD5 |
c40e1a526b10998277c34f5f29138187
|
|
| BLAKE2b-256 |
b2171ea5f79d043bb37b8c20bfdf9e6fc4ee48bb36c2d1d68d57aec3b7333343
|