diff options
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 |