Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion imagekitio/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ def copy_file(
url = "{}/v1/files/copy".format(URL.API_BASE_URL)
headers = {"Content-Type": "application/json"}
headers.update(self.request.create_headers())
formatted_options = dumps(request_formatter(options.__dict__)) if options is not None else dict()
formatted_options = dumps(request_formatter(options.__dict__))
print("here formatted options:--->", formatted_options)
resp = self.request.request(
method="Post", url=url, headers=headers, data=formatted_options
)
Expand Down
6 changes: 2 additions & 4 deletions imagekitio/models/results/FileResult.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(
updated_at,
file_id,
tags,
ai_tags: List[AITags] = [],
ai_tags: List[dict] = [],
version_info: dict = {},
embedded_metadata: dict = {},
custom_coordinates: str = "",
Expand All @@ -38,9 +38,7 @@ def __init__(
self.ai_tags: List[AITags] = []
if ai_tags is not None:
for i in ai_tags:
self.ai_tags.append(AITags(i["name"] if "name" in i else None,
i["confidence"] if "confidence" in i else None,
i["source"] if 'source' in i else None))
self.ai_tags.append(AITags(i["name"], i["confidence"], i["source"]))
self.version_info = VersionInfo(version_info["id"], version_info["name"])
self.embedded_metadata = embedded_metadata
self.custom_coordinates = custom_coordinates
Expand Down
8 changes: 4 additions & 4 deletions imagekitio/models/results/FileResultWithResponseMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def __init__(
self,
type,
name,
created_at=None,
updated_at=None,
file_id=None,
tags=None,
created_at,
updated_at,
file_id,
tags,
ai_tags: List[AITags] = AITags(None, None, None),
version_info: VersionInfo = VersionInfo(None, None),
embedded_metadata=None,
Expand Down
5 changes: 3 additions & 2 deletions tests/test_custom_metadata_fields_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TestCustomMetadataFields(ClientTestCase):

field_id = "field_id"


@responses.activate
def test_get_custom_metadata_fields_fails_on_unauthenticated_request(self):
"""
Expand All @@ -33,8 +34,8 @@ def test_get_custom_metadata_fields_fails_on_unauthenticated_request(self):
responses.GET,
url,
status=403,
body='''{"message": "Your account cannot be authenticated."
, "help": "For support kindly contact us at [email protected] ."}''',
body="'message': 'Your account cannot be authenticated.'"
", 'help': 'For support kindly contact us at [email protected] .'",
)
self.client.get_custom_metadata_fields(True)
self.assertRaises(ForbiddenException)
Expand Down
Loading