diff --git a/pyzipline/zipline.py b/pyzipline/zipline.py index dd21f61..a8cce0a 100644 --- a/pyzipline/zipline.py +++ b/pyzipline/zipline.py @@ -162,6 +162,35 @@ class ZiplineApi: raise ValueError('username not provided') raise PyZiplineError(f"{result.status_code}: {result.message}\n{result.data}") + def get_exif(self, file_id: int) -> dict: + """Get the EXIF data for a file + + /// admonition | Requires Authentication + type: warning + /// + + Args: + file_id (int): ID of the file to get EXIF data for + + Raises: + Forbidden: The user is not authenticated + NotFound: The file does not exist + PyZiplineError: Raised if the API changes, causing a breaking change in this method + + Returns: + dict: EXIF data for the file + """ + result: Result = self._rest_adapter.get(endpoint="/exif", params={'id': file_id}) + if result.status_code == 200: + return result.data + if result.status_code == 401: + raise Forbidden(result.message) + if result.message == 'image not found': + raise NotFound(result.message) + if result.message == 'image not found on fs': + raise NotFound('image not found on filesystem') + raise PyZiplineError(f"{result.status_code}: {result.message}\n{result.data}") + def get_self(self) -> User: """Get the currently authenticated user