Robot Framework keywords for the 'OpenWeatherMap' library
Project description
robotframework-openweathermap
robotframework-openweathermap
is a Robot Framework keyword collection for the OpenWeatherMap API.
Installation
The easiest way is to install this package is from pypi:
pip install robotframework-openweathermap
Robot Framework Library Examples
Prerequisites:
The accompanying Robot Framework test file relies on two requirements:
- get an OpenWeatherMap API key (it's free)
- create an environment variable
OWM_API_KEY
and assign the OpenWeatherMap API key to that variable - Execute test with
robot keyword_checks.robot
Library usage and supported keywords
Default settings
The following rules apply:
- The default value for each parameter is
None
- Each parameter supports
Getter
andSetter
keywords, e.g,Set OpenWeatherMap Latitude
- Each OpenWeatherMap Keyword also permits the usage of these parameters. Example:
Get Current Weather latitude=....
- A keyword's parameter value has priority over the
Setter
value. This means that if you useSet OpenWeathermap Latitude 10
andGet Current Weather latitude=20
, the value from the OWK Keyword will supersede theSetter
keyword and a value of20
is going to be used.
Options for setting the parameter values
You can either specify all parameters during the initial setup of the library or alternatively via separate keywords
Option 1 - set as position parameters
*** Settings ***
Library OpenWeatherMapLibrary 51.82798 9.4455 ...
*** Test Cases ***
My first test case
Option 2 - set as named parameters
*** Settings ***
Library OpenWeatherMapLibrary latitude=51.82798 longitude=9.4455 ...
*** Test Cases ***
My first test case
Option 3 - Use Robot Keywords
Set OpenWeatherMap Latitude latitude=51.82798
Generic Getter / Setter Robot Keywords supported by this library
You can use these optional Getter/Setter methods for setting your fixed default values. If you specify the same parameter as part of the actual OpenWeatherMap keyword, the value specified with that API call supersedes these generic Getter/Setter values.
Keyword | Description | Arguments | Valid Values |
---|---|---|---|
Get /Set OpenWeatherMap Latitude |
Gets / Sets the latitude value | latitude |
float value |
Get /Set OpenWeatherMap Longitude |
Gets / Sets the longitude value | longitude |
float value |
Get /Set OpenWeatherMap API Key |
Gets / Sets the OWM API Key | apikey |
string |
Get /Set OpenWeatherMap Number Of Results |
Gets / Sets the max number of results | number |
integer > 0 |
Get /Set OpenWeatherMap Language |
Gets / Sets the desired output language | language |
see OpenWeatherMap API for valid values |
Get /Set OpenWeatherMap Excludes |
Gets / Sets the exclude(s) value. Separarate multiple values with a comma See API documentation for details |
exclude |
current minutely hourly daily alerts |
Get /Set OpenWeatherMap Output Format |
Gets / Sets the output format (e.g. json ) |
output_format |
json xml html |
Get /Set OpenWeatherMap Unit Format |
Gets / Sets the unit format See API Documentation for details Format availability depends on API call |
unit_format |
standard metric imperial |
Get /Set OpenWeatherMap Datetime Start |
Gets / Sets the start datetime for date ranges | dt_start |
Unix timestamp |
Get /Set OpenWeatherMap Datetime End |
Gets / Sets the end datetime for date ranges | dt_end |
Unix timestamp |
Get /Set OpenWeatherMap Datetime |
Gets / Sets a single point in time | dt |
Unix Timestamp |
OpenWeatherMap Keywords
Please note that a majority of these keywords requires a paid OpenWeatherMap subscription. You can still try to run the keywords but most of them will fail with a http 4xx error unless you have a valid paid subscription.
Each of the following keywords has a set of mandatory parameters. which means that if you used the setter methods to assign values for latitude
and longitude
, for example, you can omit those values for the following keywords.
Keyword | Description | Mandatory parameters |
Optional parameters |
Comments |
---|---|---|---|---|
Get Current Weather | Access current weather data for any location on Earth including over 200,000 cities |
latitude longitude apikey |
output_format unit_format language |
|
Get Hourly Forecast 4 Days | Hourly forecast for 4 days (96 timestamps) | latitude longitude apikey |
output_format number language |
no output_format support for HTML |
Get OneCall Forecast | Current and forecast weather data | latitude longitude apikey |
exclude unit_format language |
|
Get Daily Forecasts 16 Days | Daily Forecast 16 Days is available at any location on the globe. | latitude longitude apikey |
number unit_format output_format language |
no output_format support for HTML |
Get Climatic Forecasts 30 Days | Climate Forecast 30 Days allows you to request daily weather data for the next 30 days | latitude longitude apikey |
number unit_format output_format language |
no output_format support for HTML |
Get Current Solar Radiation | Current solar radiation data | latitude longitude apikey |
||
Get Solar Radiation Forecast | Forecast solar radiation data | latitude longitude apikey |
||
Get Solar Radiation History | Historical solar radiation data for a from-to time span |
latitude longitude apikey dt_start dt_end |
||
Get 5 Day 3 Hour Forecast | 5 day forecast is available at any location on the globe | latitude longitude apikey |
number unit_format output_format language |
no output_format support for HTML |
Get Current Air Pollution Radiation | Current air pollution data | latitude longitude apikey |
||
Get Air Pollution Forecast | Air pollution data forecast | latitude longitude apikey |
||
Get Air Pollution History | Historical Air Pollution data for a from-to time span |
latitude longitude apikey dt_start dt_end |
||
Get Road Risk Data | Road Risk API provides weather data and national alerts at the point of destination and along a route |
latitude longitude apikey dt |
Known issues
- Not all OpenWeatherMap APIs have been assigned with corresponding Robot Framework keywords. What you see is what you get - at least for this version.
- The
Get Road Risk Data
keyword only supports a single set oflatitude
andlongitude
values (the underlying API supports multiple sets)
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
File details
Details for the file robotframework_openweathermap-1.0.4.tar.gz
.
File metadata
- Download URL: robotframework_openweathermap-1.0.4.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42fb877cf29f87240999321d56bb7d677b409ab211c6907a5f4dccf60db0198b |
|
MD5 | 2c5f611b1756466aaaec35637c1cc0a5 |
|
BLAKE2b-256 | 5bf653939db51bf3406af8f47374a6e3cc83c33dbc566941369e9f18a61a2860 |
File details
Details for the file robotframework_openweathermap-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: robotframework_openweathermap-1.0.4-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de87585a08b92ee4080f92839381d5fe4ef1b77532e73b024e33963c6cc694d8 |
|
MD5 | 3828a9d75cb82eb2a1bfbe0a1a38d441 |
|
BLAKE2b-256 | 81e877f2ec1cab8e9b1b4ab958c616bee3e0354332e603e1d7f14f1f8aa4b9e8 |