aboutsummaryrefslogtreecommitdiff
path: root/libraries/base.py
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2024-07-10 20:46:08 -0400
committerB. Stack <bgstack15@gmail.com>2024-07-10 20:46:08 -0400
commit230ed709a0631c4bd539cf698e0172a260f3bafd (patch)
treeb5759fa370a39cc56117098c2cb6f0c0efb38ae8 /libraries/base.py
parentadd el8+py3.6 support (diff)
downloadlibrary-info-230ed709a0631c4bd539cf698e0172a260f3bafd.tar.gz
library-info-230ed709a0631c4bd539cf698e0172a260f3bafd.tar.bz2
library-info-230ed709a0631c4bd539cf698e0172a260f3bafd.zip
prepare for reservations
Diffstat (limited to 'libraries/base.py')
-rw-r--r--libraries/base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/libraries/base.py b/libraries/base.py
index 74394be..f6f75e4 100644
--- a/libraries/base.py
+++ b/libraries/base.py
@@ -48,3 +48,10 @@ class BaseLibrary:
"""
This is where the login interaction should happen.
"""
+
+ def get_image(self, url):
+ """ Given the url, return the base64-encoded contents and image type as a tuple. """
+ img_response = self.session.get(url)
+ img_b64 = base64.b64encode(img_response.content).decode()
+ img_type = img_response.headers["Content-Type"]
+ return img_b64, img_type
bgstack15