diff options
author | B. Stack <bgstack15@gmail.com> | 2024-07-10 20:46:08 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2024-07-10 20:46:08 -0400 |
commit | 230ed709a0631c4bd539cf698e0172a260f3bafd (patch) | |
tree | b5759fa370a39cc56117098c2cb6f0c0efb38ae8 /libraries/base.py | |
parent | add el8+py3.6 support (diff) | |
download | library-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.py | 7 |
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 |