| Conditions | 4 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import base64 |
||
| 29 | def __call__(self): |
||
| 30 | if os.path.exists(self.location): |
||
| 31 | with open(self.location, "rb") as fp: |
||
| 32 | return self._encode(self.resize_and_convert(fp).read()) |
||
| 33 | elif self.is_url(): |
||
| 34 | content = requests.get(self.location).content |
||
| 35 | fp = io.BytesIO() |
||
| 36 | fp.write(content) |
||
| 37 | fp.seek(0) |
||
| 38 | return self._encode(self.resize_and_convert(fp).read()) |
||
| 39 | else: |
||
| 40 | raise IOError("{} not found".format(self.location)) |
||
| 41 | |||
| 66 |