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_KEYand 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
GetterandSetterkeywords, 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
Settervalue. This means that if you useSet OpenWeathermap Latitude 10andGet Current Weather latitude=20, the value from the OWK Keyword will supersede theSetterkeyword and a value of20is 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 |
currentminutelyhourlydailyalerts |
Get/Set OpenWeatherMap Output Format |
Gets / Sets the output format (e.g. json) |
output_format |
jsonxmlhtml |
Get/Set OpenWeatherMap Unit Format |
Gets / Sets the unit format See API Documentation for details Format availability depends on API call |
unit_format |
standardmetricimperial |
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 |
latitudelongitudeapikey |
output_formatunit_formatlanguage |
|
| Get Hourly Forecast 4 Days | Hourly forecast for 4 days (96 timestamps) | latitudelongitudeapikey |
output_formatnumberlanguage |
no output_formatsupport for HTML |
| Get OneCall Forecast | Current and forecast weather data | latitudelongitudeapikey |
excludeunit_formatlanguage |
|
| Get Daily Forecasts 16 Days | Daily Forecast 16 Days is available at any location on the globe. | latitudelongitudeapikey |
numberunit_formatoutput_formatlanguage |
no output_formatsupport for HTML |
| Get Climatic Forecasts 30 Days | Climate Forecast 30 Days allows you to request daily weather data for the next 30 days | latitudelongitudeapikey |
numberunit_formatoutput_formatlanguage |
no output_formatsupport for HTML |
| Get Current Solar Radiation | Current solar radiation data | latitudelongitudeapikey |
||
| Get Solar Radiation Forecast | Forecast solar radiation data | latitudelongitudeapikey |
||
| Get Solar Radiation History | Historical solar radiation data for a from-to time span |
latitudelongitudeapikeydt_startdt_end |
||
| Get 5 Day 3 Hour Forecast | 5 day forecast is available at any location on the globe | latitudelongitudeapikey |
numberunit_formatoutput_formatlanguage |
no output_formatsupport for HTML |
| Get Current Air Pollution Radiation | Current air pollution data | latitudelongitudeapikey |
||
| Get Air Pollution Forecast | Air pollution data forecast | latitudelongitudeapikey |
||
| Get Air Pollution History | Historical Air Pollution data for a from-to time span |
latitudelongitudeapikeydt_startdt_end |
||
| Get Road Risk Data | Road Risk API provides weather data and national alerts at the point of destination and along a route |
latitudelongitudeapikeydt |
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 Datakeyword only supports a single set oflatitudeandlongitudevalues (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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
|