Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
31 changes: 30 additions & 1 deletion 31 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ options = UploadFileRequestOptions(
overwrite_tags=False,
overwrite_custom_metadata=True,
custom_metadata={'testss': 12},
transformation=transformation
transformation=transformation,
checks="'request.folder' : '/testing-python-folder'", # To run server side checks before uploading files. Notice the quotes around request.folder and /testing-python-folder.
is_published=True
)

result = imagekit.upload_file(file='<url|base_64|binary>', # required
Expand Down Expand Up @@ -621,6 +623,33 @@ print(result.response_metadata.raw)
print(result.file_id)
```

**Update publish status**

If `publish` is included in the update options, no other parameters are allowed. If any are present, an error will be returned: `Your request cannot contain any other parameters when publish is present`.

```python
from imagekitio.models.UpdateFileRequestOptions import UpdateFileRequestOptions

options = UpdateFileRequestOptions(
publish={
"isPublished": True,
"includeFileVersions": True
}
)

result = imagekit.update_file_details(file_id='62cfd39819ca454d82a07182'
, options=options) # required

# Final Result
print(result)

# Raw Response
print(result.response_metadata.raw)

# print that file's id
print(result.file_id)
```

**6. Add tags**

Accepts a list of `file_ids` and `tags` as a parameter to be used to add tags. All parameters specified in
Expand Down
2 changes: 2 additions & 0 deletions 2 imagekitio/constants/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
"custom_metadata",
"embedded_metadata",
"transformation",
"checks",
"is_published",
]
3 changes: 3 additions & 0 deletions 3 imagekitio/models/UpdateFileRequestOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ def __init__(
tags: List[str] = None,
custom_coordinates: str = None,
custom_metadata: json = None,
publish: json = None,
):
if publish is not None:
self.publish = publish
if remove_ai_tags is not None:
self.remove_ai_tags = remove_ai_tags
if webhook_url is not None:
Expand Down
6 changes: 6 additions & 0 deletions 6 imagekitio/models/UploadFileRequestOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def __init__(
overwrite_custom_metadata: bool = None,
custom_metadata: json = None,
transformation: json = None,
checks: str = None,
is_published: bool = None,
):
if use_unique_file_name is not None:
self.use_unique_file_name = use_unique_file_name
Expand Down Expand Up @@ -48,3 +50,7 @@ def __init__(
self.custom_metadata = custom_metadata
if transformation is not None:
self.transformation = transformation
if checks is not None:
ahnv marked this conversation as resolved.
Show resolved Hide resolved
self.checks = checks
if is_published is not None:
self.is_published = is_published
2 changes: 1 addition & 1 deletion 2 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="imagekitio",
version="4.0.1",
version="4.1.0",
description="Python wrapper for the ImageKit API",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
145 changes: 143 additions & 2 deletions 145 tests/test_files_ops.py

Large diffs are not rendered by default.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.