The goal of this project is to create a user-friendly api client for AccuWeather api.
Project description
AccuWeather
A python library to interact with the accuweather api.
General information
For now, there is only basic functionality included in this package. However, I hope to add more features in the future.
The functionality that makes this package unique is the integration of the location client within the weather client. Specifying location by city name (and country optionally) is a more user-friendly way to interact with the api.
Before you start
You need to create an api token on the AccuWeather website (https://developer.accuweather.com).
How to use the package
""""Some code to show the functionality of the package"""
"""Some code to test and show the functionality of the package"""
from accuweather_client.clients import WeatherClient
from constants import API_KEY
import pandas as pd
# Create an instance of the WeatherClient class, a regular search
weather = WeatherClient(token=API_KEY, city="sydney")
# # Provides information about the location
weather.location
# In the example above, the selected location is Sydney, Australia
# If you like to select Sydney in Canada, you can refine your search with
# the addition of the country parameter
weather = WeatherClient(token=API_KEY, city="sydney", country="canada")
weather.location
# Create an instance of the WeatherClient class, POI search
weather = WeatherClient(token=API_KEY, poi="Eiffel tower")
weather.location
# Create an instance of the WeatherClient class, lat lon search
weather = WeatherClient(token=API_KEY, lat=51.988, lon=-4.88)
weather.location
# Creates an object that yields forecast information
forecast = weather.get_5day_forecast()
# Prints the forecast for tomorrow
forecast.forecast_tomorrow
# Returns a pandas df with forecast information
forecast_df = forecast.to_pandas_df()
# Parse the day column and add to df
forecast_df_parsed = pd.concat(
[forecast_df, pd.json_normalize(forecast_df["Day"])], axis=1
)
# Creates an object that yiels information about the current conditions
conditions = weather.get_current_conditions()
# Prints the current conditions
conditions.current_conditions
Project details
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
Close
Hashes for accuweather_client-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e34cad2139c0326fe0ad58e3c6486beb4fd94ff23a18f0a692ea88fbfd21bc46 |
|
MD5 | c4c617360ff56e5660dc0a544605906f |
|
BLAKE2b-256 | 459b2a81c44f28609671f4bd87e8f53e701fc16c4236ebbfd772d5f62d9be395 |