halo.API module

class halo.API.API[source]

Bases: object

This class is a wrapper for the Rest API endpoints of www.weatherbit.io. Currently it implements fetching current weather, forecast and 1 day (limit on free plan) historic weather data.

get_current_weather(query)[source]

Fetches and returns current weather data.

Parameters:query – search query
Returns:a tuple containing city, city timezone, current weather data.
get_forecast_weather(query)[source]

Fetches and returns the forecast weather data.

Parameters:query – search query
Returns:forecast weather data.
get_forecast_weather_chart(query)[source]

Fetches and returns the forecast weather chart data.

Parameters:query – search query
Returns:charting data.
get_weather_history(query, tz)[source]

Fetches and returns the historic weather data(1 day).

Parameters:
  • query – search query
  • tz – city timezone
Returns:

historic weather data.

get_weather_history_chart(query, tz)[source]

Fetches and returns the historic weather data chart data(1 day).

Parameters:
  • query – search query
  • tz – city timezone
Returns:

charting data.

exception halo.API.APIError[source]

Bases: Exception

An Exception class for exceptions that occur due to external problems with the API service.

exception halo.API.NotFound[source]

Bases: halo.API.APIError

An Exception that will occur when data for a city is not found.

exception halo.API.RateLimitReached[source]

Bases: halo.API.APIError

Daily rate limit of API service has been reached and we must wait until it resets.