Weather

forecast_weather.weather.get_current(location: str)

Returns the current weather conditions at a given location.

Parameters:

location (str) – Query for a location, could be a US Zipcode, UK Postcode, Canada Postalcode, IP address, Latitude/Longitude (decimal degree) or city name.

Returns:

A hash map containing the name of the location, current temperature in Fahrenheit/Celsius, weather condition, wind speed, air pressure, precipitation, humidity, cloud coverage, and UV of the specified location.

Return type:

dict

Note

In regards to accessing the weather data from the returned dictionary, the relevant keys are name, condition, temp_c, temp_f, wind_mph, pressure_mb, precip_in, humidity, cloud, uv.

forecast_weather.weather.get_forecast(location: str, days: str)

Returns the forecast weather conditions at a given location.

Parameters:
  • location (str) – Query for a location, could be a US Zipcode, UK Postcode, Canada Postalcode, IP address, Latitude/Longitude (decimal degree) or city name.

  • days (str) – Value from 1 to 10 that specifies the number of days to forecast. There may be tighter upper limits depending on the particular plan one’s API key is from. See https://www.weatherapi.com/pricing.aspx for more information.

Returns:

A hash map containing the name of the location, forecast temperature in Fahrenheit/Celsius, weather condition, wind speed, air pressure, precipitation, humidity, cloud coverage, and UV of the specified location across the time frame.

Return type:

dict

Note

In regards to accessing the weather data from the returned dictionary, the relevant keys are name and the dates in the format YYYY-MM-DD. The dates access a nested dictionary where the relevant keys are avgtemp_f, avgtemp_c, condition, maxwind_mph, totalprecip_in, avghumidity, and uv.

forecast_weather.weather.show_current(location: str)

Prints the current weather conditions at a given location.

Parameters:

location (str) – Query for a location, could be a US Zipcode, UK Postcode, Canada Postalcode, IP address, Latitude/Longitude (decimal degree) or city name.

Returns:

See note for the printing side effect.

Return type:

None

Note

Prints the current temperature in Fahrenheit/Celsius, weather condition, wind speed, air pressure, precipitation, humidity, cloud coverage, and UV of the specified location.

forecast_weather.weather.show_forecast(location: str, days: str)

Prints the forecast weather conditions at a given location across a given number of days.

Parameters:
  • location (str) – Query for a location, could be a US Zipcode, UK Postcode, Canada Postalcode, IP address, Latitude/Longitude (decimal degree) or city name.

  • days (str) – Value from 1 to 10 that specifies the number of days to forecast. There may be tighter upper limits depending on the particular plan one’s API key is from. See https://www.weatherapi.com/pricing.aspx for more information.

Returns:

See note for the printing side effect.

Return type:

None

Note

Prints the forecast average temperature in Fahrenheit/Celsius, weather condition, max wind speed, total precipitation, average humidity, and UV of the specified location across the time frame.