Support omitting the params if none required in the Flickr API
- ID
10604ec- date
2023-12-27 12:25:25+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
72c0ade- message
Support omitting the params if none required in the Flickr API- changed files
1 file, 8 additions, 3 deletions
Changed files
flickr/flapi.sh (444) → flickr/flapi.sh (503)
diff --git a/flickr/flapi.sh b/flickr/flapi.sh
index fe9afd6..c9d1b3a 100755
--- a/flickr/flapi.sh
+++ b/flickr/flapi.sh
@@ -9,14 +9,19 @@
set -o errexit
set -o nounset
-if (( $# != 2 ))
+if (( $# == 1 ))
then
+ method="$1"
+ params=""
+elif (( $# == 2 ))
+then
+ method="$1"
+ params="$2"
+else
echo "Usage: $0 <METHOD> <PARAMS>" >&2
exit 1
fi
-method="$1"
-params="$2"
api_key=$(keyring get flickr_api key)
curl "https://api.flickr.com/services/rest/?api_key=${api_key}&method=${method}&${params}"