imagekit-python
imagekit-python copied to clipboard
ListAndSearchFileRequestOptions reports module not callable
code
from imagekitio.models.UploadFileRequestOptions import UploadFileRequestOptions
from imagekitio.models.CreateFolderRequestOptions import CreateFolderRequestOptions
from imagekitio.models import ListAndSearchFileRequestOptions
from imagekitio import ImageKit
import os
def list_files():
# list_files = imagekit.list_files(options=ListAndSearchFileRequestOptions(path="/static/assets/js/"))
list_files = imagekit.list_files(options=ListAndSearchFileRequestOptions(skip=0, limit = 10))
print("List files-", "\n", list_files)
# Raw Response
print(list_files.response_metadata.raw)
# print the first file's ID
print(list_files.list[0].name)
print(list_files())
Error
(flask_env) root@sunil-desktop:/data/NeuralEdit/service_files/FrontendServer# python3 /data/NeuralEdit/service_files/FrontendServer/apps/home/utils/imagekit_ops.py
Traceback (most recent call last):
File "/data/NeuralEdit/service_files/FrontendServer/apps/home/utils/imagekit_ops.py", line 55, in <module>
print(list_files())
File "/data/NeuralEdit/service_files/FrontendServer/apps/home/utils/imagekit_ops.py", line 44, in list_files
list_files = imagekit.list_files(options=ListAndSearchFileRequestOptions(skip=0, limit = 10))
TypeError: 'module' object is not callable
Hi @snlpatel001213, before proceeding, ensure you've initialized the SDK. Below is a sample code snippet for initialization. For further details, refer to the documentation here:
from imagekitio import ImageKit
imagekit = ImageKit(
private_key='your_private_key',
public_key='your_public_key',
url_endpoint='your_url_endpoint'
)