From be0928ce1c65024d87721c237f37abd17bb08caf Mon Sep 17 00:00:00 2001 From: KeeganForelight Date: Fri, 13 Jan 2023 16:12:50 -0500 Subject: [PATCH] added server search --- server_weather.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server_weather.sh b/server_weather.sh index 28bad80..a53f4f0 100755 --- a/server_weather.sh +++ b/server_weather.sh @@ -9,23 +9,22 @@ source "$WORKING_DIR/.env.key" lookup_location() { # search for a location url="http://api.openweathermap.org/geo/1.0/direct?q=$SEARCH&appid=$API_KEY" - RES=$(curl --silent "$url") - echo "$RES" | gojq '.' + curl --silent -fL "$url" } lookup_zipcode() { # lookup based on zipcode url="http://api.openweathermap.org/geo/1.0/zip?zip=$ZIPCODE&appid=$API_KEY" - RES=$(curl --silent "$url") - echo "$RES" | gojq '.' + curl --silent -fL "$url" } get_weather() { - # calls server for weather based on $LAT, $LONG + # calls server for weather based on $COORDS + LAT=$(echo "$COORDS" | awk -F , '{print $1}') + LON=$(echo "$COORDS" | awk -F , '{print $2}') url="https://api.openweathermap.org/data/2.5/weather\?lat=$LAT\&lon=$LON\&appid=$API_KEY\&units=imperial" - RES=$(curl --silent "$url") - echo "$RES" | gojq '.' + curl --silent -fL "$url" } while getopts "c:s:z:" arg; do