Core

class openweatherwrap.core.AirPollutionResponse(data)

Bases: object

Class to handle the response data for air pollution information. It provides methods to extract various air quality parameters from the response data.

get_ammonia()

Returns a list of ammonia (NH₃) levels for the air pollution data. The NH₃ levels are typically measured in micrograms per cubic meter (µg/m³).

Return ammonia:

List of NH₃ levels (floats).

Return type:

list[float]

get_aqi()

Returns a list of Air Quality Index (AQI) values for the air pollution data. The AQI is typically an integer representing the air quality level.

Return aqi:

List of AQI values (integers).

Return type:

list[int]

get_carbon_monoxide()

Returns a list of carbon monoxide (CO) levels for the air pollution data. The CO levels are typically measured in micrograms per cubic meter (µg/m³).

Return carbon_monoxide:

List of CO levels (floats).

Return type:

list[float]

get_coord()

Returns the coordinates of the location from the response data. The coordinates are typically represented as a list of two integers [longitude, latitude].

Return coord:

List of coordinates [longitude, latitude].

Return type:

list[int]

get_nitrogen_dioxide()

Returns a list of nitrogen dioxide (NO₂) levels for the air pollution data. The NO₂ levels are typically measured in micrograms per cubic meter (µg/m³).

Return nitrogen_dioxide:

List of NO₂ levels (floats).

Return type:

list[float]

get_nitrogen_monoxide()

Returns a list of nitrogen monoxide (NO) levels for the air pollution data. The NO levels are typically measured in micrograms per cubic meter (µg/m³).

Return nitrogen_monoxide:

List of NO levels (floats).

Return type:

list[float]

get_ozone()

Returns a list of ozone (O₃) levels for the air pollution data. The O₃ levels are typically measured in micrograms per cubic meter (µg/m³).

Return ozone:

List of O₃ levels (floats).

Return type:

list[float]

get_pm10()

Returns a list of PM10 (particulate matter with a diameter of less than 10 micrometers) levels for the air pollution data. The PM10 levels are typically measured in micrograms per cubic meter (µg/m³).

Return pm10:

List of PM10 levels (floats).

Return type:

list[float]

get_pm2_5()

Returns a list of PM2.5 (particulate matter with a diameter of less than 2.5 micrometers) levels for the air pollution data. The PM2.5 levels are typically measured in micrograms per cubic meter (µg/m³).

Return pm2_5:

List of PM2.5 levels (floats).

Return type:

list[float]

get_sulphur_dioxide()

Returns a list of sulphur dioxide (SO₂) levels for the air pollution data. The SO₂ levels are typically measured in micrograms per cubic meter (µg/m³).

Return sulphur_dioxide:

List of SO₂ levels (floats).

Return type:

list[float]

get_times()

Returns a list of timestamps for the air pollution data. The timestamps are typically represented as Unix timestamps (seconds since epoch).

Return times:

List of timestamps (integers).

Return type:

list[int]

class openweatherwrap.core.CurrentWeatherResponse(data, mode='json')

Bases: object

A class to handle the response from the OpenWeather Current Weather API.

get_base()

Returns the base of the weather data from the response data.

Returns None if the mode is ‘xml’ since the base is not available in those formats.

Return base:

Base as a string or None.

Return type:

str | None

get_city_id()

Returns the city ID from the response data. The city ID is typically an integer representing the unique identifier of the city.

Return city_id:

City ID as an integer or None.

Return type:

int | None

get_city_name()

Returns the city name from the response data. The city name is typically a string representing the name of the city.

Return city_name:

City name as a string or None.

Return type:

str | None

get_clouds()

Returns the cloudiness from the response data. Cloudiness is typically measured as a percentage (0-100%).

Return clouds:

Cloudiness as an integer or None.

Return type:

int | None

get_clouds_name()

Returns the name of the cloudiness from the response data. The name is typically a string representing the cloudiness category.

Returns None if the mode is ‘json’ since the name is not available in that format.

Return clouds_name:

Cloudiness name as a string or None.

Return type:

str | None

get_country()

Returns the country code from the response data. The country code is typically a two-letter ISO 3166-1 alpha-2 code.

Returns None if the mode is ‘xml’ since country code is not available in those formats.

Return country:

Country code as a string or None.

Return type:

str | None

get_feels_like()

Returns the feels-like temperature from the response data. Feels-like temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return feels_like:

Feels-like temperature as a float or None.

Return type:

float | None

get_feels_like_unit()

Returns the unit of the feels-like temperature from the response data. The unit is typically ‘metric’ for Celsius or ‘imperial’ for Fahrenheit.

Returns None if the mode is ‘json’ since the unit is not available in that format.

Return feels_like_unit:

Feels-like temperature unit as a string or None.

Return type:

str | None

get_ground_level_pressure()

Returns the ground level pressure from the response data. Ground level pressure is typically measured in hPa (hectopascals).

Returns None if the mode is ‘xml’ since ground level pressure is not available in those formats.

Return ground_level_pressure:

Ground level pressure as an integer or None.

Return type:

int | None

get_humidity()

Returns the humidity from the response data. Humidity is typically measured as a percentage (0-100%).

Return humidity:

Humidity as an integer or None.

Return type:

int | None

get_humidity_unit()

Returns the unit of the humidity from the response data. The unit is typically ‘percent’ for percentage.

Returns None if the mode is ‘json’ since the unit is not available in that format.

Return humidity_unit:

Humidity unit as a string or None.

Return type:

str | None

get_lastupdate()

Returns the last update time from the response data. The last update is a string in the format ‘YYYY-MM-DD HH:MM:SS’.

Returns None if the mode is ‘json’ since last update time is not available in those formats.

Return last_update:

Last update time as an integer (Unix timestamp) or None.

Return type:

str | None

get_latitude()

Returns the latitude from the response data. Latitude will be a value between -90 and 90.

Return latitude:

Latitude as a float.

Return type:

float

get_longitude()

Returns the longitude from the response data. Longitude will be a value between -180 and 180.

Return longitude:

Longitude as a float.

Return type:

float

get_pressure()

Returns the atmospheric pressure from the response data. Pressure is typically measured in hPa (hectopascals).

Return pressure:

Atmospheric pressure as an integer or None.

Return type:

int | None

get_pressure_unit()

Returns the unit of the atmospheric pressure from the response data. The unit is typically ‘hPa’ (hectopascals).

Returns None if the mode is ‘json’ since the unit is not available in that format.

Return pressure_unit:

Atmospheric pressure unit as a string or None.

Return type:

str | None

get_rain()

Returns the rain volume from the response data. Rain volume is typically measured in millimeters/hour (mm/h).

Return rain:

Rain volume as a float or None.

Return type:

float | None

get_sea_level_pressure()

Returns the sea level pressure from the response data. Sea level pressure is typically measured in hPa (hectopascals).

Returns None if the mode is ‘xml’ since sea level pressure is not available in those formats.

Return sea_level_pressure:

Sea level pressure as an integer or None.

Return type:

int | None

get_snow()

Returns the snow volume from the response data. Snow volume is typically measured in millimeters/hour (mm/h).

Return snow:

Snow volume as a float or None.

Return type:

float | None

get_sunrise()

Returns the sunrise time from the response data. Sunrise time is typically represented as a Unix timestamp (seconds since epoch).

Sunrise will be a string in XML or HTML mode, while in JSON mode it will be an integer.

Return sunrise:

Sunrise time as an integer (Unix timestamp) or None.

Return type:

int | str | None

get_sunset()

Returns the sunset time from the response data. Sunset time is typically represented as a Unix timestamp (seconds since epoch).

Sunset will be a string in XML or HTML mode, while in JSON mode it will be an integer.

Return sunset:

Sunset time as an integer (Unix timestamp) or None.

Return type:

int | None

get_sys_id()

Returns the system ID from the response data. The system ID is typically an integer representing the unique identifier of the system.

Returns None if the mode is ‘xml’ since system ID is not available in those formats.

Return sys_id:

System ID as an integer or None.

Return type:

int | None

get_sys_message()

Returns the system message from the response data. The system message is typically a float representing additional information about the system.

Returns None if the mode is ‘xml’ since system message is not available in those formats.

Return sys_message:

System message as a float or None.

Return type:

float | None

get_sys_type()

Returns the system type from the response data. The system type is typically an integer representing the type of data.

Returns None if the mode is ‘xml’ since system type is not available in those formats.

Return sys_type:

System type as an integer or None.

Return type:

int | None

get_temparature()

Returns the current temperature from the response data. Temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return temperature:

Current temperature as a float or None.

Return type:

float | None

get_temperature_max()

Returns the maximum temperature from the response data. Maximum temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return max_temperature:

Maximum temperature as a float or None.

Return type:

float | None

get_temperature_min()

Returns the minimum temperature from the response data. Minimum temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return min_temperature:

Minimum temperature as a float or None.

Return type:

float | None

get_temperature_unit()

Returns the unit of the temperature from the response data. The unit is typically ‘metric’ for Celsius or ‘imperial’ for Fahrenheit.

Returns None if the mode is ‘json’ since the unit is not available in that format.

Return temperature_unit:

Temperature unit as a string or None.

Return type:

str | None

get_time()

Returns the time of the weather data from the response data. The time is typically represented as a Unix timestamp (seconds since epoch).

Returns None if the mode is ‘xml’ since time is not available in those formats.

Return time:

Time as an integer (Unix timestamp) or None.

Return type:

int | None

get_timezone()

Returns the timezone offset from the response data. The timezone offset is typically represented in seconds from UTC.

Return timezone:

Timezone offset as an integer (seconds) or None.

Return type:

int | None

get_visibility()

Returns the visibility from the response data. Visibility is typically measured in meters.

The maximum visibility is 10,000 meters, and values above this are often capped at 10,000.

Return visibility:

Visibility as an integer or None.

Return type:

int | None

get_weather_description()

Returns the weather description from the response data.

Return weather_description:

Weather description as a string or None.

Return type:

str | None

get_weather_icon()

Returns the weather icon code from the response data.

Return weather_icon:

Weather icon code as a string or None.

Return type:

str | None

get_weather_id()

Returns the weather condition ID from the response data.

Return weather_id:

Weather condition ID as an integer.

Return type:

int

get_weather_main()

Returns the main weather description from the response data.

Returns None if the mode is ‘xml’ since the main description is not available in those formats.

Return weather_main:

Weather main description as a string or None.

Return type:

str | None

get_wind_deg()

Returns the wind direction from the response data. Wind direction is typically measured in degrees (0-360).

Return wind_deg:

Wind direction as an integer or None.

Return type:

int | None

get_wind_direction()

Returns the wind direction as a string from the response data. The direction is typically represented as a cardinal direction (e.g., ‘N’, ‘NE’, ‘E’, etc.).

Returns None if the mode is ‘json’ since the direction is not available in that format.

Return wind_direction:

Wind direction as a string or None.

Return type:

str | None

get_wind_direction_full()

Returns the full wind direction as a string from the response data. The full direction is typically represented as a more descriptive string (e.g., ‘North’, ‘Northeast’, etc.).

Returns None if the mode is ‘json’ since the full direction is not available in that format.

Return wind_direction_full:

Full wind direction as a string or None.

Return type:

str | None

get_wind_gust()

Returns the wind gust speed from the response data. Wind gust speed is typically measured in meters per second (m/s).

Returns None if the mode is ‘xml’ since wind gust speed is not available in those formats.

Return wind_gust:

Wind gust speed as a float or None.

Return type:

float | None

get_wind_speed()

Returns the wind speed from the response data. Wind speed is typically measured in meters per second (m/s).

Return wind_speed:

Wind speed as a float or None.

Return type:

float | None

get_wind_speed_name()

Returns the name of the wind speed from the response data. The name is typically a string representing the wind speed category.

Returns None if the mode is ‘json’ since the name is not available in that format.

Return wind_speed_name:

Wind speed name as a string or None.

Return type:

str | None

get_wind_speed_unit()

Returns the unit of the wind speed from the response data. The unit is typically ‘m/s’ (meters per second).

Returns None if the mode is ‘json’ since the unit is not available in that format.

Return wind_speed_unit:

Wind speed unit as a string or None.

Return type:

str | None

class openweatherwrap.core.FiveDayForecastResponse(data, mode='json')

Bases: object

A class to handle the response from the OpenWeather 5-Day Forecast API.

get_altitude()

Returns the altitude of the city from the response data. The altitude is typically a float representing the height above sea level in meters.

Returns -1.0 if the mode is ‘json’ since altitude is not available in those formats.

Return altitude:

Altitude as a float or None.

Return type:

float

get_calctime()

Returns the calculation time from the response data. The calculation time is typically represented as a Unix timestamp (seconds since epoch).

Returns -1 if the mode is ‘json’ since calculation time is not available in those formats.

Return calc_time:

Calculation time as an integer (Unix timestamp).

Return type:

int

get_city_id()

Returns the city ID from the response data. The city ID is typically an integer representing the unique identifier of the city.

Returns -1 if the mode is ‘xml’ since city ID is not available in those formats.

Return city_id:

City ID as an integer or None.

Return type:

int

get_city_name()

Returns the city name from the response data. The city name is typically a string representing the name of the city.

Return city_name:

City name as a string or None.

Return type:

str | None

get_clouds()

Returns a list of cloudiness values for each forecast entry. Cloudiness is typically measured as a percentage (0-100%).

Return clouds:

List of cloudiness values (integers).

Return type:

list[int]

get_clouds_name()

Returns a list of cloudiness names for each forecast entry. The cloudiness name is typically a string representing the cloudiness category (e.g., ‘clear’, ‘cloudy’).

Returns an empty list if the mode is ‘json’ since the name is not available in that format.

Return clouds_name:

List of cloudiness names (strings).

Return type:

list[str | None]

get_clouds_unit()

Returns the units of the cloudiness from the response data. The units are typically ‘percent’ for percentage.

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return clouds_unit:

Cloudiness unit as a string or None.

Return type:

list[str | None]

get_count()

Returns the count of forecast entries from the response data. The count is typically an integer representing the number of forecast entries.

The count is an internal parameter.

Returns an empty list if the mode is ‘xml’ since the count is not available in those formats.

Return count:

Count of forecast entries as an integer.

Return type:

int

get_country()

Returns the country code from the response data. The country code is typically a string representing the ISO 3166-1 alpha-2 code of the country.

Return country:

Country code as a string or None.

Return type:

str | None

get_feels_like()

Returns a list of feels-like temperatures for each forecast entry. Feels-like temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return feels_like:

List of feels-like temperatures (floats).

Return type:

list[float]

get_feels_like_unit()

Returns the units of the feels-like temperature from the response data. The units are typically ‘Celsius’ for metric or ‘Fahrenheit’ for imperial.

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return feels_like_unit:

Feels-like temperature unit as a string.

Return type:

list[str | None]

get_geobase()

Returns the geobase of the city from the response data. The geobase is typically a string representing the geographical base of the city.

Returns an empty string if the mode is ‘json’ since geobase is not available in those formats.

Return geobase:

Geobase as a string or None.

Return type:

str | None

get_geobase_id()

Returns the geobase ID of the city from the response data. The geobase ID is typically an integer representing the unique identifier of the geographical base.

Returns -1 if the mode is ‘json’ since geobase ID is not available in those formats.

Return geobase_id:

Geobase ID as an integer or None.

Return type:

int

get_ground_level_pressure()

Returns a list of ground level pressures for each forecast entry. Ground level pressure is typically measured in hPa (hectopascals).

Returns an empty list if the mode is ‘xml’ since ground level pressure is not available in those formats.

Return ground_level_pressure:

List of ground level pressures (integers).

Return type:

list[int]

get_humidity()

Returns a list of humidity values for each forecast entry. Humidity is typically measured as a percentage (0-100%).

Return humidity:

List of humidity values (integers).

Return type:

list[int | None]

get_humidity_unit()

Returns the units of the humidity from the response data. The units are typically ‘percent’ for percentage.

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return humidity_unit:

Humidity unit as a string.

Return type:

list[str | None]

get_lastupdate()

Returns the last update time from the response data. The last update time is typically represented as a Unix timestamp (seconds since epoch).

Returns -1 if the mode is ‘json’ since last update time is not available in those formats.

Return last_update:

Last update time as an integer (Unix timestamp).

Return type:

int | None

get_latitude()

Returns the latitude of the city from the response data. Latitude is typically a float representing the geographical coordinate.

Return latitude:

Latitude as a float or None.

Return type:

float | None

get_longitude()

Returns the longitude of the city from the response data. Longitude is typically a float representing the geographical coordinate.

Return longitude:

Longitude as a float or None.

Return type:

float | None

get_message()

Returns the message from the response data. The message is typically an integer representing the status of the response.

The message is an internal parameter.

Returns None if the mode is ‘xml’ since the message is not available in those formats.

Return message:

Message as an integer or None.

Return type:

int

get_next_update()

Returns the next update time from the response data. The next update time is typically represented as a Unix timestamp (seconds since epoch).

Returns -1 if the mode is ‘json’ since next update time is not available in those formats.

Return next_update:

Next update time as an integer (Unix timestamp).

Return type:

int

get_part_of_day()

Returns a list of part of day for each forecast entry. Part of day is typically represented as a string (n - night, d - day).

Returns an empty list if the mode is ‘xml’ since part of day is not available in those formats.

Return part_of_day:

List of part of day (strings).

Return type:

list[str | None]

get_pop()

Returns a list of probability of precipitation (POP) values for each forecast entry. The values of the parameter vary between 0 and 1, where 0 is equal to 0%, 1 is equal to 100%

Return pop:

List of POP values (floats).

Return type:

list[float]

get_population()

Returns the population of the city from the response data. The population is typically an integer representing the number of inhabitants in the city.

Returns -1 if the mode is ‘xml’ since population is not available in those formats.

Return population:

Population as an integer.

Return type:

int

get_pressure()

Returns a list of atmospheric pressures for each forecast entry. Pressure is typically measured in hPa (hectopascals).

Return pressure:

List of atmospheric pressures (integers).

Return type:

list[int | None]

get_pressure_unit()

Returns the units of the atmospheric pressure from the response data. The units are typically ‘hPa’ (hectopascals).

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return pressure_unit:

Atmospheric pressure unit as a string.

Return type:

list[str | None]

get_rain()

Returns a list of rain volume for each forecast entry. Rain volume is typically measured in millimeters (mm).

Return rain:

List of rain volumes (floats).

Return type:

list[float]

get_sea_level_pressure()

Returns a list of sea level pressures for each forecast entry. Sea level pressure is typically measured in hPa (hectopascals).

Returns an empty list if the mode is ‘xml’ since sea level pressure is not available in those formats.

Return sea_level_pressure:

List of sea level pressures (integers).

Return type:

list[int]

get_snow()

Returns a list of snow volume for each forecast entry. Snow volume is typically measured in millimeters (mm).

Return snow:

List of snow volumes (floats).

Return type:

list[float]

get_sunrise()

Returns the sunrise time from the response data. The sunrise time is typically represented as a Unix timestamp (seconds since epoch).

Return sunrise:

Sunrise time as an integer (Unix timestamp) or in the ISO 8601 format.

Return type:

str | int

get_sunset()

Returns the sunset time from the response data. The sunset time is typically represented as a Unix timestamp (seconds since epoch).

Return sunset:

Sunset time as an integer (Unix timestamp) or in the ISO 8601 format.

Return type:

str | int

get_temperature()

Returns a list of temperatures for each forecast entry.

Return temperature:

List of temperatures (floats).

Return type:

list[float]

get_temperature_max()

Returns a list of maximum temperatures for each forecast entry. Maximum temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return max_temperature:

List of maximum temperatures (floats).

Return type:

list[float]

get_temperature_min()

Returns a list of minimum temperatures for each forecast entry. Minimum temperature is typically measured in degrees Celsius (°C) or Fahrenheit (°F).

Return min_temperature:

List of minimum temperatures (floats).

Return type:

list[float]

get_temperature_unit()

Returns the units of the temperature from the response data. The units are typically ‘Celsius’ for metric or ‘Fahrenheit’ for imperial.

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return temperature_unit:

Temperature unit as a string.

Return type:

list[str]

get_times()

Returns the timestamps of the forecast data from the response data. The timestamps are typically represented as a Unix timestamp (seconds since epoch).

Returns an empty list if the mode is ‘xml’ since the timestamp is not available in those formats.

Return timestamp:

Timestamp as an integer (Unix timestamp).

Return type:

list[int]

get_timezone()

Returns the timezone offset from the response data. The timezone offset is typically an integer representing the offset in seconds from UTC.

Return timezone:

Timezone offset as an integer.

Return type:

int

get_visibility()

Returns a list of visibility values for each forecast entry. Visibility is typically measured in meters (m).

Return visibility:

List of visibility values (integers).

Return type:

list[int]

get_weather_description()

Returns a list of weather condition descriptions for each forecast entry. Weather condition descriptions are typically strings providing more detailed information about the weather (e.g., ‘clear sky’, ‘few clouds’).

Return weather_description:

List of weather condition descriptions (strings).

Return type:

list[str | None]

get_weather_icon()

Returns a list of weather condition icons for each forecast entry. Weather condition icons are typically strings representing the icon code for the weather condition.

Return weather_icon:

List of weather condition icons (strings).

Return type:

list[str | None]

get_weather_id()

Returns a list of weather condition IDs for each forecast entry. Weather condition IDs are typically integers representing different weather conditions.

Return weather_id:

List of weather condition IDs (integers).

Return type:

list[int]

get_weather_main()

Returns a list of main weather conditions for each forecast entry. Main weather conditions are typically strings representing the general weather condition (e.g., ‘Clear’, ‘Clouds’, ‘Rain’).

Returns an empty list if the mode is ‘xml’ since main weather conditions are not available in those formats.

Return weather_main:

List of main weather conditions (strings).

Return type:

list[str | None]

get_wind_deg()

Returns a list of wind degrees for each forecast entry. Wind degrees are typically measured in degrees (0-360).

Return wind_deg:

List of wind degrees (floats).

Return type:

list[float]

get_wind_direction()

Returns a list of wind directions for each forecast entry. Wind direction is typically represented as a string (e.g., ‘N’, ‘NE’, ‘E’, etc.).

Returns an empty list if the mode is ‘json’ since wind direction is not available in those formats.

Return wind_direction:

List of wind directions (strings).

Return type:

list[str | None] | None

get_wind_direction_full()

Returns a list of full wind directions for each forecast entry. Full wind direction is typically represented as a string (e.g., ‘North’, ‘Northeast’, ‘East’, etc.).

Returns an empty list if the mode is ‘json’ since full wind direction is not available in those formats.

Return wind_direction_full:

List of full wind directions (strings).

Return type:

list[str | None]

get_wind_gust()

Returns a list of wind gusts for each forecast entry. Wind gusts are typically measured in meters per second (m/s).

Return wind_gust:

List of wind gusts (floats).

Return type:

list[float]

get_wind_gust_unit()

Returns the units of the wind gust from the response data. The units are typically ‘m/s’ (meters per second).

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return wind_gust_unit:

Wind gust unit as a string or None.

Return type:

list[str | None]

get_wind_speed()

Returns a list of wind speeds for each forecast entry. Wind speed is typically measured in meters per second (m/s).

Return wind_speed:

List of wind speeds (floats).

Return type:

list[float]

get_wind_speed_name()

Returns a list of wind speed names for each forecast entry. The wind speed name is typically a string representing the wind speed category (e.g., ‘calm’, ‘light breeze’).

Returns an empty list if the mode is ‘json’ since the name is not available in that format.

Return wind_speed_name:

List of wind speed names (strings).

Return type:

list[str | None]

get_wind_speed_unit()

Returns the units of the wind speed from the response data. The units are typically ‘m/s’ (meters per second).

Returns an empty list if the mode is ‘json’ since the unit is not available in that format.

Return wind_speed_unit:

Wind speed unit as a string or None.

Return type:

list[str | None]

class openweatherwrap.core.GeocodingResponse(data)

Bases: object

Class to handle the response data for geocoding information. It provides methods to extract various geocoding parameters from the response data.

get_country()

Returns the country code from the response data. The country code is typically a string representing the ISO 3166-1 alpha-2 code of the country.

Return country:

Country code as a string or None.

Return type:

list[str | None] | str | None

get_latitude()

Returns the latitude of the location from the response data. Latitude is typically a float representing the geographical coordinate.

Return latitude:

Latitude as a float.

Return type:

list[float] | float

get_local_names()

Returns a dictionary of local names for the location from the response data. Local names are typically represented as a dictionary with language codes as keys and names as values.

Return local_names:

Dictionary of local names (language code: name).

Return type:

list[dict[str, str]] | dict[str, str]

get_longitude()

Returns the longitude of the location from the response data. Longitude is typically a float representing the geographical coordinate.

Return longitude:

Longitude as a float.

Return type:

list[float] | float

get_name()

Returns the name of the location from the response data. The name is typically a string representing the name of the location.

Return name:

Location name as a string or None.

Return type:

list[str | None] | str | None

get_state()

Returns the state or region from the response data. The state is typically a string representing the name of the state or region.

Return state:

State or region as a string or None.

Return type:

list[str | None] | str | None

get_zip()

Returns the zip code specified in the API request.

Return zip:

Zip code as a string or None.

Return type:

str | None

class openweatherwrap.core.OneCallAggregationResponse(data)

Bases: object

A class to handle the aggregation response from the OpenWeather One Call API.

get_cloud_cover_afternoon()

Returns a list of cloud cover values for the afternoon period of each daily forecast entry.

Return cloud_cover_afternoon:

The cloud coverage.

Return type:

int

get_date()

Returns the date from the aggregation response data. Date is a string in the format ‘YYYY-MM-DD’.

Return date:

Date as a string.

Return type:

str

get_humidity_afternoon()

Returns a list of humidity values for the afternoon period of each daily forecast entry.

Return humidity_afternoon:

The humidity.

Return type:

int

get_latitude()

Returns the latitude from the aggregation response data. Latitude will be a value between -90 and 90.

Return latitude:

Latitude as a float.

Return type:

float

get_longitude()

Returns the longitude from the aggregation response data. Longitude will be a value between -180 and 180.

Return longitude:

Longitude as a float.

Return type:

float

get_pressure_afternoon()

Returns a list of atmospheric pressures for each daily forecast entry.

Return pressure_afternoon:

The pressure for the afternoon.

Return type:

int

get_temperature_afternoon()

Returns a list of afternoon temperatures for each daily forecast entry.

Return temperature_afternoon:

The temperature in the afternoon.

Return type:

float

get_temperature_evening()

Returns a list of evening temperatures for each daily forecast entry.

Return temperature_evening:

The temperature in the evening.

Return type:

float

get_temperature_max()

Returns a list of maximum temperatures for each daily forecast entry.

Return temperature_max:

The maximum themperature.

Return type:

float

get_temperature_min()

Returns a list of minimum temperatures for each daily forecast entry.

Return temperature_min:

The minimum temperature.

Return type:

float

get_temperature_morning()

Returns a list of morning temperatures for each daily forecast entry.

Return temperature_morning:

The temperature in the morning.

Return type:

float

get_temperature_night()

Returns a list of nighttime temperatures for each daily forecast entry.

Return temperature_night:

The temperature at night.

Return type:

float

get_timezone()

Returns the timezone from the aggregation response data. Timezone is a string representing the timezone of the location. Example: ‘+00:00’

Return timezone:

Timezone as a string.

Return type:

str

get_total_precipitation()

Returns a list of total precipitation values for each daily forecast entry.

Return total_precipitation:

The total precipitation.

Return type:

float

get_units()

Returns the units used in the aggregation response data. Units can be ‘metric’, ‘imperial’, or ‘standard’.

Return units:

Units as a string.

Return type:

str

get_wind_max_direction()

Returns a list of maximum wind directions for each daily forecast entry.

Return wind_max_direction:

The maximum wind direction.

Return type:

int

get_wind_max_speed()

Returns a list of maximum wind speeds for each daily forecast entry.

Return wind_max_speed:

The maximum wind speed.

Return type:

float

class openweatherwrap.core.OneCallResponse(data)

Bases: object

A class to handle the response from the OpenWeather One Call API.

get_alerts()

Returns a list of alerts from the response data.

Return alerts:

List of OpenWeatherAlert objects.

Return type:

list[OpenWeatherAlert]

get_current_clouds()

Returns the current cloudiness in % from the response data.

Return clouds:

Current cloudiness as an integer or None.

Return type:

int | None

get_current_dew_point()

Returns the current dew point from the response data.

Return dew_point:

Current dew point as a float or None.

Return type:

float | None

get_current_feels_like()

Returns the current feels-like temperature from the response data. Feels-like temperature is the perceived temperature, which may differ from the actual temperature due to factors like humidity and wind.

Return feels_like:

Feels-like temperature as a float.

Return type:

float | None

get_current_humidity()

Returns the current humidity in % from the response data.

Return humidity:

Current humidity as an integer or None.

Return type:

int | None

get_current_pressure()

Returns the current atmospheric pressure from the response data. Pressure is measured in hPa (hectopascals).

Return pressure:

Current pressure as an integer.

Return type:

int

get_current_rain()

Returns the current rain volume from the response data. Rain volume is typically measured in mm (millimeters).

Return rain:

Current rain volume as a float or None.

Return type:

float | None

get_current_snow()

Returns the current snow volume from the response data. Snow volume is typically measured in mm (millimeters).

Return snow:

Current snow volume as a float or None.

Return type:

float | None

get_current_sunrise()

Returns the sunrise time in seconds since the epoch from the response data. This is the time of sunrise for the current day.

Return sunrise:

Sunrise time as an integer (timestamp).

Return type:

int | None

get_current_sunset()

Returns the sunset time in seconds since the epoch from the response data. This is the time of sunset for the current day.

Return sunset:

Sunset time as an integer (timestamp).

Return type:

int | None

get_current_temp()

Returns the current temperature from the response data. Temperature is in Kelvin by default, but can be converted to Celsius or Fahrenheit as needed.

Return temp:

Current temperature as a float.

Return type:

float | None

get_current_time()

Returns the current time in seconds since the epoch from the response data. This is the time of the current weather data.

Return current_time:

Current time as an integer (timestamp).

Return type:

int | None

get_current_uvi()

Returns the current UV index from the response data.

Return uvi:

Current UV index as a float or None.

Return type:

float | None

get_current_visibility()

Returns the current visibility in km from the response data.

Return visibility:

Current visibility as an integer or None.

Return type:

int | None

get_current_weather_description()

Returns the current weather description from the response data.

Return weather_description:

Weather description as a string or None.

Return type:

str | None

get_current_weather_icon()

Returns the current weather icon code from the response data.

Return weather_icon:

Weather icon code as a string or None.

Return type:

str | None

get_current_weather_id()

Returns the current weather condition ID from the response data.

Return weather_id:

Weather condition ID as an integer.

Return type:

int

get_current_weather_main()

Returns the current weather main description from the response data.

Return weather_main:

Weather main as a string or None.

Return type:

str | None

get_current_wind_deg()

Returns the current wind direction in degrees from the response data.

Return wind_deg:

Current wind direction as an integer or None.

Return type:

int | None

get_current_wind_gust()

Returns the current wind gust speed from the response data.

Return wind_gust:

Current wind gust as a float or None.

Return type:

float | None

get_current_wind_speed()

Returns the current wind speed from the response data. Wind speed is typically measured in meters per second (m/s), but can be converted to miles per hour (mph).

Return wind_speed:

Current wind speed as a float or None.

Return type:

float | None

get_daily_clouds()

Returns a list of cloudiness values for each daily forecast entry.

Return daily_clouds:

List of cloudiness values (integers).

Return type:

list[int | None]

get_daily_dew_point()

Returns a list of dew point values for each daily forecast entry.

Return daily_dew_point:

List of dew point values (floats).

Return type:

list[float | None]

get_daily_feels_like_day()

Returns a list of daytime feels-like temperatures for each daily forecast entry.

Return daily_feels_like_day:

List of daytime feels-like temperatures (floats).

Return type:

list[float | None]

get_daily_feels_like_eve()

Returns a list of evening feels-like temperatures for each daily forecast entry.

Return daily_feels_like_eve:

List of evening feels-like temperatures (floats).

Return type:

list[float | None]

get_daily_feels_like_morning()

Returns a list of morning feels-like temperatures for each daily forecast entry.

Return daily_feels_like_morning:

List of morning feels-like temperatures (floats).

Return type:

list[float | None]

get_daily_feels_like_night()

Returns a list of nighttime feels-like temperatures for each daily forecast entry.

Return daily_feels_like_night:

List of nighttime feels-like temperatures (floats).

Return type:

list[float | None]

get_daily_humidity()

Returns a list of humidity values for each daily forecast entry.

Return daily_humidity:

List of humidity values (integers).

Return type:

list[int | None]

get_daily_moon_phase()

Returns a list of moon phase values for each daily forecast entry.

Return daily_moon_phase:

List of moon phase values (floats).

Return type:

list[float | None]

get_daily_moonrise()

Returns a list of moonrise times for each daily forecast entry.

Return daily_moonrise:

List of moonrise times (integers).

Return type:

list[int | None]

get_daily_moonset()

Returns a list of moonset times for each daily forecast entry.

Return daily_moonset:

List of moonset times (integers).

Return type:

list[int | None]

get_daily_pop()

Returns a list of probability of precipitation values for each daily forecast entry.

Return daily_pop:

List of probability of precipitation values (floats).

Return type:

list[float | None]

get_daily_pressure()

Returns a list of atmospheric pressures for each daily forecast entry.

Return daily_pressure:

List of pressures (integers).

Return type:

list[int | None]

get_daily_rain()

Returns a list of rain volume values for each daily forecast entry.

Return daily_rain:

List of rain volume values (floats).

Return type:

list[float | None]

get_daily_snow()

Returns a list of snow volume values for each daily forecast entry.

Return daily_snow:

List of snow volume values (floats).

Return type:

list[float | None]

get_daily_summary()

Returns a list of summary strings for each daily forecast entry.

Return daily_summary:

List of summary strings (strings).

Return type:

list[str | None]

get_daily_sunrise()

Returns a list of sunrise times for each daily forecast entry.

Return daily_sunrise:

List of sunrise times (integers).

Return type:

list[int | None]

get_daily_sunset()

Returns a list of sunset times for each daily forecast entry.

Return daily_sunset:

List of sunset times (integers).

Return type:

list[int | None]

get_daily_temp_day()

Returns a list of daytime temperatures for each daily forecast entry.

Return daily_temp_day:

List of daytime temperatures (floats).

Return type:

list[float | None]

get_daily_temp_eve()

Returns a list of evening temperatures for each daily forecast entry.

Return daily_temp_eve:

List of evening temperatures (floats).

Return type:

list[float | None]

get_daily_temp_max()

Returns a list of maximum temperatures for each daily forecast entry.

Return daily_temp_max:

List of maximum temperatures (floats).

Return type:

list[float | None]

get_daily_temp_min()

Returns a list of minimum temperatures for each daily forecast entry.

Return daily_temp_min:

List of minimum temperatures (floats).

Return type:

list[float | None]

get_daily_temp_morning()

Returns a list of morning temperatures for each daily forecast entry.

Return daily_temp_morning:

List of morning temperatures (floats).

Return type:

list[float | None]

get_daily_temp_night()

Returns a list of nighttime temperatures for each daily forecast entry.

Return daily_temp_night:

List of nighttime temperatures (floats).

Return type:

list[float | None]

get_daily_times()

Returns a list of timestamps for each daily forecast entry.

Return daily_times:

List of timestamps (integers).

Return type:

list[int | None]

get_daily_uvi()

Returns a list of UV index values for each daily forecast entry.

Return daily_uvi:

List of UV index values (floats).

Return type:

list[float | None]

get_daily_weather_description()

Returns a list of weather descriptions for each daily forecast entry.

Return daily_weather_description:

List of weather descriptions (strings).

Return type:

list[str | None]

get_daily_weather_icon()

Returns a list of weather icon codes for each daily forecast entry.

Return daily_weather_icon:

List of weather icon codes (strings).

Return type:

list[str | None]

get_daily_weather_id()

Returns a list of weather condition IDs for each daily forecast entry.

Return daily_weather_id:

List of weather condition IDs (integers).

Return type:

list[int]

get_daily_weather_main()

Returns a list of weather main descriptions for each daily forecast entry.

Return daily_weather_main:

List of weather main descriptions (strings).

Return type:

list[str | None]

get_daily_wind_deg()

Returns a list of wind direction values for each daily forecast entry.

Return daily_wind_deg:

List of wind direction values (integers).

Return type:

list[int | None]

get_daily_wind_gust()

Returns a list of wind gust values for each daily forecast entry.

Return daily_wind_gust:

List of wind gust values (floats).

Return type:

list[float | None]

get_daily_wind_speed()

Returns a list of wind speed values for each daily forecast entry.

Return daily_wind_speed:

List of wind speed values (floats).

Return type:

list[float | None]

get_hourly_clouds()

Returns a list of cloudiness values for each hourly forecast entry.

Return hourly_clouds:

List of cloudiness values (integers).

Return type:

list[int | None]

get_hourly_dew_point()

Returns a list of dew point values for each hourly forecast entry.

Return hourly_dew_point:

List of dew point values (floats).

Return type:

list[float | None]

get_hourly_feels_like()

Returns a list of feels-like temperatures for each hourly forecast entry.

Return hourly_feels_like:

List of feels-like temperatures (floats).

Return type:

list[float | None]

get_hourly_humidity()

Returns a list of humidity values for each hourly forecast entry.

Return hourly_humidity:

List of humidity values (integers).

Return type:

list[int | None]

get_hourly_pop()

Returns a list of probability of precipitation values for each hourly forecast entry.

Return hourly_pop:

List of probability of precipitation values (floats).

Return type:

list[float | None]

get_hourly_pressure()

Returns a list of atmospheric pressures for each hourly forecast entry.

Return hourly_pressure:

List of pressures (integers).

Return type:

list[int | None]

get_hourly_rain()

Returns a list of rain volume values for each hourly forecast entry.

Return hourly_rain:

List of rain volume values (floats).

Return type:

list[float | None]

get_hourly_snow()

Returns a list of snow volume values for each hourly forecast entry.

Return hourly_snow:

List of snow volume values (floats).

Return type:

list[float | None]

get_hourly_temp()

Returns a list of temperatures for each hourly forecast entry.

Return hourly_temp:

List of temperatures (floats).

Return type:

list[float | None]

get_hourly_times()

Returns a list of timestamps for each hourly forecast entry.

Return hourly_times:

List of timestamps (integers).

Return type:

list[int | None]

get_hourly_uvi()

Returns a list of UV index values for each hourly forecast entry.

Return hourly_uvi:

List of UV index values (floats).

Return type:

list[float | None]

get_hourly_visibility()

Returns a list of visibility values for each hourly forecast entry.

Return hourly_visibility:

List of visibility values (integers).

Return type:

list[int | None]

get_hourly_weather_description()

Returns a list of weather descriptions for each hourly forecast entry.

Return hourly_weather_description:

List of weather descriptions (strings).

Return type:

list[str | None]

get_hourly_weather_icon()

Returns a list of weather icon codes for each hourly forecast entry.

Return hourly_weather_icon:

List of weather icon codes (strings).

Return type:

list[str | None]

get_hourly_weather_id()

Returns a list of weather condition IDs for each hourly forecast entry.

Return hourly_weather_id:

List of weather condition IDs (integers).

Return type:

list[int]

get_hourly_weather_main()

Returns a list of weather main descriptions for each hourly forecast entry.

Return hourly_weather_main:

List of weather main descriptions (strings).

Return type:

list[str | None]

get_hourly_wind_deg()

Returns a list of wind direction values for each hourly forecast entry.

Return hourly_wind_deg:

List of wind direction values (integers).

Return type:

list[int | None]

get_hourly_wind_gust()

Returns a list of wind gust values for each hourly forecast entry.

Return hourly_wind_gust:

List of wind gust values (floats).

Return type:

list[float | None]

get_hourly_wind_speed()

Returns a list of wind speed values for each hourly forecast entry.

Return hourly_wind_speed:

List of wind speed values (floats).

Return type:

list[float | None]

get_latitude()

Returns the latitude from the response data. Latitude will be a value between -90 and 90.

Return latitude:

Latitude as a float.

Return type:

float

get_longitude()

Returns the longitude from the response data. Longitude will be a value between -180 and 180.

Return longitude:

Longitude as a float.

Return type:

float

get_minutely_precipitation()

Returns a list of precipitation values for each minutely forecast entry.

Return minutely_precipitation:

List of precipitation values (floats).

Return type:

list[float | None]

get_minutely_times()

Returns a list of timestamps for each minutely forecast entry.

Return minutely_times:

List of timestamps (integers).

Return type:

list[int | None]

get_timezone()

Returns the timezone from the response data. Timezone is a string representing the timezone of the location. Example: ‘America/New_York’

Return timezone:

Timezone as a string.

Return type:

str

get_timezone_offset()

Returns the timezone offset from the response data. Timezone offset is the difference in seconds from UTC. Example: -14400 for UTC-4 (Eastern Daylight Time).

Return timezone_offset:

Timezone offset as an integer.

Return type:

int

class openweatherwrap.core.OneCallTimestampedResponse(data)

Bases: object

A class to handle the timestamped response from the OpenWeather One Call API.

get_clouds()

Returns the cloudiness from the response data.

Returns:

The cloudiness as an integer.

Return type:

int

get_dew_point()

Returns the dew point from the response data.

Returns:

The dew point as a float.

Return type:

float

get_feels_like()

Returns the feels-like temperature from the response data.

Returns:

The feels-like temperature as a float.

Return type:

float

get_humidity()

Returns the humidity from the response data.

Returns:

The humidity as an integer.

Return type:

int

get_latitude()

Returns the latitude of the location from the response data.

Return latitude:

Latitude as a float.

Return type:

float

get_longitude()

Returns the longitude of the location from the response data.

Return longitude:

Longitude as a float.

Return type:

float

get_pressure()

Returns the atmospheric pressure from the response data.

Returns:

The atmospheric pressure as an integer.

Return type:

int

get_sunrise()

Returns the sunrise time from the response data.

Returns:

The sunrise time as a timestamp.

Return type:

int

get_sunset()

Returns the sunset time from the response data.

Returns:

The sunset time as a timestamp.

Return type:

int

get_temperature()

Returns the temperature from the response data.

Returns:

The temperature as a float.

Return type:

float

get_time()

Returns the time of the response data.

Returns:

The time of the response data as a timestamp.

Return type:

int

get_timezone()

Returns the timezone of the location from the response data.

Return timezone:

Timezone as a string.

Return type:

str

get_timezone_offset()

Returns the timezone offset in seconds from the response data.

Return timezone_offset:

Timezone offset as an integer.

Return type:

int

get_uvi()

Returns the UV index from the response data.

Returns:

The UV index as a float.

Return type:

float

get_visibility()

Returns the visibility from the response data.

Returns:

The visibility as an integer.

Return type:

int

get_weather_description()

Returns the weather description from the response data.

Returns:

The weather description as a string or None.

Return type:

str | None

get_weather_icon()

Returns the weather icon code from the response data.

Returns:

The weather icon code as a string or None.

Return type:

str | None

get_weather_id()

Returns the weather condition ID from the response data.

Returns:

The weather condition ID as an integer.

Return type:

int

get_weather_main()

Returns the main weather description from the response data.

Returns:

The main weather description as a string or None.

Return type:

str | None

get_wind_deg()

Returns the wind direction in degrees from the response data.

Returns:

The wind direction as an integer.

Return type:

int

get_wind_speed()

Returns the wind speed from the response data.

Returns:

The wind speed as a float.

Return type:

float

class openweatherwrap.core.OpenWeatherAlert(data)

Bases: object

A class to represent an alert from the OpenWeather API.

get_description()

Returns a description of the alert.

Return description:

Description of the alert as a string or None if not available.

Return type:

str | None

get_end()

Returns the end time of the alert in Unix timestamp format.

Return end:

End time as an integer (timestamp) or None if not available.

Return type:

int | None

get_event()

Returns the event type of the alert.

Return event:

Event type as a string or None if not available.

Return type:

str | None

get_sender_name()

Returns the name of the sender of the alert.

Return sender_name:

Sender name as a string or None if not available.

Return type:

str | None

get_start()

Returns the start time of the alert in Unix timestamp format.

Return start:

Start time as an integer (timestamp) or None if not available.

Return type:

int | None

get_tags()

Returns a list of tags associated with the alert.

Return tags:

List of tags as strings. If no tags are available, returns an empty list.

Return type:

list[str]