feat: added get_exif method
This commit is contained in:
parent
5568832f74
commit
b998ef968f
1 changed files with 29 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue