added server search
This commit is contained in:
parent
d48c183f12
commit
be0928ce1c
@ -9,23 +9,22 @@ source "$WORKING_DIR/.env.key"
|
|||||||
lookup_location() {
|
lookup_location() {
|
||||||
# search for a location
|
# search for a location
|
||||||
url="http://api.openweathermap.org/geo/1.0/direct?q=$SEARCH&appid=$API_KEY"
|
url="http://api.openweathermap.org/geo/1.0/direct?q=$SEARCH&appid=$API_KEY"
|
||||||
RES=$(curl --silent "$url")
|
curl --silent -fL "$url"
|
||||||
echo "$RES" | gojq '.'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lookup_zipcode() {
|
lookup_zipcode() {
|
||||||
# lookup based on zipcode
|
# lookup based on zipcode
|
||||||
url="http://api.openweathermap.org/geo/1.0/zip?zip=$ZIPCODE&appid=$API_KEY"
|
url="http://api.openweathermap.org/geo/1.0/zip?zip=$ZIPCODE&appid=$API_KEY"
|
||||||
RES=$(curl --silent "$url")
|
curl --silent -fL "$url"
|
||||||
echo "$RES" | gojq '.'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_weather() {
|
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"
|
url="https://api.openweathermap.org/data/2.5/weather\?lat=$LAT\&lon=$LON\&appid=$API_KEY\&units=imperial"
|
||||||
RES=$(curl --silent "$url")
|
curl --silent -fL "$url"
|
||||||
echo "$RES" | gojq '.'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "c:s:z:" arg; do
|
while getopts "c:s:z:" arg; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user