Skip to main content

CI codecov GitHub Release PyPI PyPI - Downloads Buy me a coffee PayPal_Me Revolut.Me

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

accuweather-5.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

accuweather-5.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file accuweather-5.1.0.tar.gz.

File metadata

  • Download URL: accuweather-5.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for accuweather-5.1.0.tar.gz
Algorithm Hash digest
SHA256 87e7e62760c7afbd217d3fcca358e53765aa000df524ec15a5d17cebb1a28b61
MD5 b13bb9361fb0e2fb6c020b52e001174d
BLAKE2b-256 18391a10df3d41a83a36e4c21e41793e64e1ada4537a1ad4decf28b43cf955dc

See more details on using hashes here.

File details

Details for the file accuweather-5.1.0-py3-none-any.whl.

File metadata

  • Download URL: accuweather-5.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for accuweather-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da048af53e67392e8eb2666822f6f2b5d3d3a0232c88dbc04050678a75e9543c
MD5 ca65af63f83144e7f1268f8f565d7ef4
BLAKE2b-256 4f3639a95e8d93f926ba4bbfd91f9632757e11007ec22509796f1e2523d1bae2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

5.1.0 This release

2 files

5.0.0

2 files

4.2.2

2 files

4.2.1

2 files

4.2.0

2 files

4.1.0

2 files

4.0.0

2 files

3.0.0

2 files

2.1.1

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.0.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page