diff --git a/src/get/immich.py b/src/get/immich.py index 30e4f0c..0c80eed 100644 --- a/src/get/immich.py +++ b/src/get/immich.py @@ -46,11 +46,12 @@ class ImageGetImmich(ImageGet): def get_image_file(self, image_id: str) -> bytearray: - url = self.base_url + "download/asset/" + image_id + url = self.base_url + f"assets/{image_id}/original" + print(url) headers = self.headers | {"Accept": "application/octet-stream"} - response = h.request("POST", url, headers=headers, data={}) + response = h.request("GET", url, headers=headers, data={}) if not response.status_code == 200: - raise ImageGetException("Error in step get_image_file: " + str(response.status_code)) + raise ImageGetException(f"Error in step get_image_file: {response.status_code}" ) return response.content diff --git a/src/get/template.py b/src/get/template.py index f8c5ab5..3542c49 100644 --- a/src/get/template.py +++ b/src/get/template.py @@ -25,8 +25,8 @@ class ImageGet: id = self.get_random_image_ids()[0] bytes = self.get_image_file(id) self.save_cached_files() - except (h.ConnectError, h.HTTPStatusError, h.NetworkError, h.RequestError, h.DecodingError, h.TransportError, ImageGetException): - print("Loading image from cache") + except (h.ConnectError, h.HTTPStatusError, h.NetworkError, h.RequestError, h.DecodingError, h.TransportError, ImageGetException) as e: + print(f"Encoutered {e}, loading image from cache") bytes = self.load_cached_file() return bytes @@ -46,8 +46,8 @@ class ImageGet: new_cache = self.cache_dir / f"{uuid.uuid4()}" try: new_cache.write_bytes(self.get_image_file(id)) - except ImageGetException: - print("Could not cache image, skipping") + except ImageGetException as e: + print(f"Could not cache image, skipping ({e})") continue def load_cached_file(self) -> bytearray: