pyowm.uvindexapi30 package

Subpackages

Submodules

pyowm.uvindexapi30.uvindex module

class pyowm.uvindexapi30.uvindex.UVIndex(reference_time, location, value, reception_time)[source]

Bases: object

A class representing the UltraViolet Index observed in a certain location in the world. The location is represented by the encapsulated Location object.

Parameters:
  • reference_time (int) – GMT UNIXtime telling when the UV data have been measured
  • location (Location) – the Location relative to this UV observation
  • value (float) – the observed UV intensity value
  • reception_time (int) – GMT UNIXtime telling when the observation has been received from the OWM Weather API
Returns:

an UVIndex instance

Raises:

ValueError when negative values are provided as reception time or UV intensity value

get_exposure_risk()[source]

Returns a string stating the risk of harm from unprotected sun exposure for the average adult on this UV observation :return: str

get_location()[source]

Returns the Location object for this UV observation

Returns:the Location object
get_reception_time(timeformat='unix')[source]

Returns the GMT time telling when the UV has been received from the API

Parameters:timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_reference_time(timeformat='unix')[source]
Returns the GMT time telling when the UV has been observed
from the OWM Weather API
Parameters:timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_value()[source]

Returns the UV intensity for this observation

Returns:float
to_JSON()[source]

Dumps object fields into a JSON formatted string

Returns:the JSON string
to_XML(xml_declaration=True, xmlns=True)[source]

Dumps object fields to an XML-formatted string. The ‘xml_declaration’ switch enables printing of a leading standard XML line containing XML version and encoding. The ‘xmlns’ switch enables printing of qualified XMLNS prefixes.

Parameters:
  • XML_declaration (bool) – if True (default) prints a leading XML declaration line
  • xmlns (bool) – if True (default) prints full XMLNS prefixes
Returns:

an XML-formatted string

pyowm.uvindexapi30.uvindex.uv_intensity_to_exposure_risk(uv_intensity)[source]

pyowm.uvindexapi30.parsers module

pyowm.uvindexapi30.uv_client module

pyowm.uvindexapi30.uris module

URIs templates for resources exposed by the UVIndex API 3.0

Module contents