Write a python script named "forcast_collector" that will collect the hourly temperature from
the following site:
https://weather.com/weather/hourbyhour/l/ISXX0026:1:IS
And save the table data in a json file named "forcast_data.json.
Json Structure:
{
"time": {
"DESC": "Rain|Showers",
"TEMP": "Temperature",
"FEEL": "Temperature",
" PRECIP": "% precip",
"HUMIDITY": "% humidity",
"WIND" : "Wind description"
}
}
Example:
{
"12:00 AM": {
"DESC": "Rain ",
"TEMP": "14",
"FEEL": "12",
" PRECIP": "70%",
"HUMIDITY": "90% ",
"WIND" : "SSE 8 km/h"
}
}
Create MD5Sum file for the script
Upload the script & the MD5 into Github.
Write Jenkins pipeline job with Jenkinsfile that will perform the following:
- Checkout the Github repository.
- Stage 1: Verify the MD5 against the script file.
- Stage 2: execute the script.
- Stage 3: Validate "temperature_data.json" structure (make sure the json structure is OK).
-
The script should work on ubuntu servers.
-
Write clean code
-
Comments are welcome.
-
In case a special package is required add a comment with the following information:
- Name of the package.
- What the package does.
- Which command was used to install the package?
Adding pip requirements file will be nice
-
Once the code is ready send us a link to the GitHub repository.
The following packages needs to be installed:
pandas
OR you can use the requirements.txt file instead
pip install -r requirements.txt
The pandas package is a powerful Python data analysis toolkit. In our script we use it to extract data from the forecast website in a tabular format.
In this repo there is a Jenkinsfile
which can be used into a jenkins server in order to fulfill Step 2
In adition to what was required in step 2 the pipeline also do the following:
- use the hash.md5 file to validate the
requirements.txt
(in adition to the script validation) - installs the python package requirements (
pip install -r requirements.txt
)