Skip to content

Instantly share code, notes, and snippets.

@fedir
Last active February 19, 2019 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedir/a11ce92b71808c8e8306653225658b26 to your computer and use it in GitHub Desktop.
Save fedir/a11ce92b71808c8e8306653225658b26 to your computer and use it in GitHub Desktop.

Open Weather API call

Installation procedure

  • Create scripts
  • Define CITY_ID and APP_ID in each script
  • Add scritps into the crontab

Crontab

42 7 * * *  bash somepath/oweather_daily.sh > somepath/weather_daily.json
42 7 * * *  bash somepath/oweather_5days.sh > somepath/weather_5days.json
#!/bin/bash
CITY_ID=XXXX
APP_ID=YYYY
DURATION_CODE="forecast"
CURL_URL="https://api.openweathermap.org/data/2.5/${DURATION_CODE}?id=${CITY_ID}&lang=fr&units=metric&appid=${APP_ID}"
curl "$CURL_URL"
#!/bin/bash
CITY_ID=XXXX
APP_ID=YYYY
DURATION_CODE="weather"
CURL_URL="https://api.openweathermap.org/data/2.5/${DURATION_CODE}?id=${CITY_ID}&lang=fr&units=metric&appid=${APP_ID}"
curl "$CURL_URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment