feat: added get_exif method

This commit is contained in:
Seaswimmer 2023-12-22 13:50:45 -05:00
parent 5568832f74
commit b998ef968f
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -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