From a42ca5340be6dc92a744fc19a0aa27c60b5c57ea Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Wed, 5 Feb 2020 16:09:27 -0500 Subject: metar/taf: update avwx api --- templates/.bin/metar | 7 ++++--- templates/.bin/taf | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/templates/.bin/metar b/templates/.bin/metar index a9d7429..e81a028 100755 --- a/templates/.bin/metar +++ b/templates/.bin/metar @@ -21,9 +21,10 @@ while [ $# -gt 0 ]; do esac shift done -json=$(curl -s "https://avwx.rest/api/metar/${station:-KBOS}?options=speech") +token=$(pass show avwx-token) +json=$(curl -s -H "Authorization: ${token}" "https://avwx.rest/api/metar/${station:-KBOS}?options=speech") if [ $say -gt 0 ]; then - echo "$json" | "$jq" --raw-output '.Speech' 2>&1 | say + echo "$json" | "$jq" --raw-output '.speech' 2>&1 | say else - echo "$json" | "$jq" --raw-output '.["Raw-Report"]' 2>&1 + echo "$json" | "$jq" --raw-output '.raw' 2>&1 fi diff --git a/templates/.bin/taf b/templates/.bin/taf index 9564b95..f7047d7 100755 --- a/templates/.bin/taf +++ b/templates/.bin/taf @@ -6,6 +6,7 @@ if [[ ! -x "$jq" && -x "/usr/local/bin/jq" ]]; then fi station=$(echo -n "$1" | tr "a-z" "A-Z") -json=$(curl -s "https://avwx.rest/api/taf/${station:-KBOS}") -echo "$json" | "$jq" --raw-output '.["Raw-Report"]' 2>&1 +token=$(pass show avwx-token) +json=$(curl -s -H "Authorization: ${token}" "https://avwx.rest/api/taf/${station:-KBOS}") +echo "$json" | "$jq" --raw-output '.raw' 2>&1 -- cgit v1.2.3