Skip to main content

Add my flapi and flphoto scripts

ID
8b10176
date
2023-11-15 09:08:27+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
23a8089
message
Add my flapi and flphoto scripts
changed files
7 files, 63 additions, 1 deletion

Changed files

.with-venv-python/flapi (0) → .with-venv-python/flapi (137)

diff --git a/.with-venv-python/flapi b/.with-venv-python/flapi
new file mode 100755
index 0000000..749c6b0
--- /dev/null
+++ b/.with-venv-python/flapi
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+source ~/repos/scripts/.venv/bin/activate
+
+bash ~/repos/scripts/flickr/flapi.sh "$@"

.with-venv-python/flphoto (0) → .with-venv-python/flphoto (139)

diff --git a/.with-venv-python/flphoto b/.with-venv-python/flphoto
new file mode 100755
index 0000000..580adb9
--- /dev/null
+++ b/.with-venv-python/flphoto
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+source ~/repos/scripts/.venv/bin/activate
+
+bash ~/repos/scripts/flickr/flphoto.sh "$@"

flickr/README.md (0) → flickr/README.md (589)

diff --git a/flickr/README.md b/flickr/README.md
new file mode 100644
index 0000000..b95756a
--- /dev/null
+++ b/flickr/README.md
@@ -0,0 +1,25 @@
+# flickr
+
+These scripts do stuff with the Flickr API.
+
+## The individual scripts
+
+<dl>
+  <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/flickr/flapi.sh">
+      <code>flapi.sh [METHOD] [PARAMS]</code>
+    </a>
+  </dt>
+  <dd>
+    call a method with the Flickr API and print the XML response to stdout.
+  </dd>
+  
+  <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/flickr/flphoto.sh">
+      <code>flphoto.sh [METHOD] [PARAMS]</code>
+    </a>
+  </dt>
+  <dd>
+    look up a single photo with the Flickr API and print the XML response to stdout.
+  </dd>
+</dl>

flapi (444) → flickr/flapi.sh (444)

diff --git a/flapi b/flickr/flapi.sh
similarity index 100%
rename from flapi
rename to flickr/flapi.sh

flickr/flphoto.sh (0) → flickr/flphoto.sh (186)

diff --git a/flickr/flphoto.sh b/flickr/flphoto.sh
new file mode 100755
index 0000000..290d688
--- /dev/null
+++ b/flickr/flphoto.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+if (( $# != 1 ))
+then
+  echo "Usage: $0 <PHOTO_ID>" >&2
+  exit 1
+fi
+
+PHOTO_ID="$1"
+
+flapi.sh flickr.photos.getInfo photo_id=$PHOTO_ID

requirements.in (40) → requirements.in (48)

diff --git a/requirements.in b/requirements.in
index 28a88e3..d7a101c 100644
--- a/requirements.in
+++ b/requirements.in
@@ -1,5 +1,6 @@
 black
 flake8
 hyperlink
+keyring
 Pillow
 pip-tools

requirements.txt (903) → requirements.txt (1020)

diff --git a/requirements.txt b/requirements.txt
index 6be7194..8387d65 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
 # This file is autogenerated by pip-compile with Python 3.12
 # by the following command:
 #
-#    pip-compile requirements.in
+#    pip-compile
 #
 black==23.11.0
     # via -r requirements.in
@@ -18,8 +18,14 @@ hyperlink==21.0.0
     # via -r requirements.in
 idna==3.4
     # via hyperlink
+jaraco-classes==3.3.0
+    # via keyring
+keyring==24.3.0
+    # via -r requirements.in
 mccabe==0.7.0
     # via flake8
+more-itertools==10.1.0
+    # via jaraco-classes
 mypy-extensions==1.0.0
     # via black
 packaging==23.2