The story feature uses AI algorithms to group photos by time or person into curated collections, each with an automatically selected cover image.
Use cases
Photo album
The story feature uses AI algorithms to group photos in a dataset by time or person into a collection called a story, and automatically selects a high-quality photo as the cover image. Use this feature to build a photo album of your best moments.
Prerequisites
A metadata index is created for the files based on your use case. For more information, see Create a metadata index.
Create a story
Call the CreateStory operation to group files from the test-dataset dataset within the test-project project based on criteria like story type and time range.
Task information is retained for only seven days. After this period, the information cannot be retrieved. To obtain task information promptly, use one of the following methods:
-
Call the GetTask or ListTasks operation to view task information.
-
Activate Message Service (MNS) in the same region as Intelligent Media Management (IMM) and configure a subscription to receive prompt task notifications. For more information about the asynchronous notification format, see Asynchronous notification message format. For more information about the MNS SDK, see Step 4: Receive and delete messages.
-
Activate ApsaraMQ for RocketMQ in the same region as IMM and create a RocketMQ 4.0 instance, a topic, and a consumer group to receive prompt task notifications. For more information about the asynchronous notification format, see Asynchronous notification message format. For more information about how to use ApsaraMQ for RocketMQ, see Use HTTP SDKs to send and receive normal messages.
-
Activate and integrate with EventBridge in the same region as IMM to receive prompt task notifications. For more information, see Intelligent Media Management (IMM) events.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "id1",
"StoryName": "name1",
"StoryType": "PeopleMemory",
"StorySubType": "Solo",
"StoryStartTime": "2016-12-30T16:00:00Z",
"StoryEndTime": "2022-12-30T16:00:00Z",
"MinFileCount": 1,
"UserData": "abcdef",
"Tags": "{\"test\": \"test val1\"}",
"MaxFileCount": 3,
}
Sample response
{
"TaskId": "CreateStory-234047f7-07bd-48bd-b248-4bf5f445****",
"RequestId": "80C00576-B137-083B-B8CD-BD4F1907****",
"EventId": "108-1RG91at3VV0dCqBAripTktO****"
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
tags = {}
create_story_request = imm_20200930_models.CreateStoryRequest(
# Specify the following request parameters.
project_name='test-project',
dataset_name='test-dataset',
story_type='PeopleMemory',
story_name='name1',
object_id='id1',
story_sub_type='Solo',
story_start_time='2016-12-30T16:00:00Z',
story_end_time='2022-12-30T16:00:00Z',
max_file_count=3,
min_file_count=1,
user_data='abcdef',
tags=tags
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.create_story_with_options(create_story_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Get a story
Call the GetStory operation to retrieve details about a specific story in the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "id2"
}
Sample response
{
"RequestId": "1D8F812A-205C-3708-B16C-AAF2EBB7****",
"Story": {
"StoryName": "name2",
"ProjectName": "test-project",
"ObjectId": "id2",
"CreateTime": "2022-11-25T10:19:32.289204882+08:00",
"StoryType": "PeopleMemory",
"Addresses": [
{
"Township": "",
"Country": "",
"City": "",
"District": "",
"Province": ""
}
],
"ObjectType": "story",
"Cover": {
"OSSURI": "",
"URI": "oss://test-bucket/test-object"
},
"OwnerId": "1023210024677934",
"DatasetName": "test-dataset",
"StoryEndTime": "2022-12-31T00:00:00+08:00",
"StorySubType": "Solo",
"UpdateTime": "2022-11-25T10:19:32.289204882+08:00",
"StoryStartTime": "2016-12-31T00:00:00+08:00",
"Files": [
{
"URI": "oss://test-bucket/test-object"
},
{
"URI": "oss://test-bucket/test-object-1"
},
{
"URI": "oss://test-bucket/test-object-2"
}
]
}
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
get_story_request = imm_20200930_models.GetStoryRequest(
# Specify the following three parameters.
project_name='test-project',
dataset_name='test-dataset',
object_id='1D8F812A-205C-3708-B16C-AAF2EBB7****'
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.get_story_with_options(get_story_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Query stories
Call the QueryStories operation to query stories in the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset"
}
Sample response
{
"RequestId": "434321B1-3663-02F0-9410-0CC9ADFD****",
"NextToken": "",
"Stories": [
{
"StoryName": "name2",
"ProjectName": "test-project",
"ObjectId": "id2",
"CreateTime": "2022-11-25T10:19:32.289204882+08:00",
"StoryType": "PeopleMemory",
"Addresses": [
{
"Township": "",
"Country": "",
"City": "",
"District": "",
"Province": ""
}
],
"ObjectType": "story",
"Cover": {
"OSSURI": "",
"URI": "oss://test-bucket/test-object"
},
"OwnerId": "1023210024677934",
"DatasetName": "test-dataset",
"StoryEndTime": "2022-12-31T00:00:00+08:00",
"StorySubType": "Solo",
"UpdateTime": "2022-11-25T10:19:32.289204882+08:00",
"StoryStartTime": "2016-12-31T00:00:00+08:00",
"Files": [
{
"URI": "oss://test-bucket/test-object"
},
{
"URI": "oss://test-bucket/test-object-1"
},
{
"URI": "oss://test-bucket/test-object-2"
}
]
}
]
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
query_stories_request = imm_20200930_models.QueryStoriesRequest(
# Specify the following two parameters.
project_name='test-project',
dataset_name='test-dataset'
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.query_stories_with_options(query_stories_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Add files to a story
Call the AddStoryFiles operation to add files to a specific story in the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "id2",
"Files": "[{\"URI\": \"oss://test-bucket/test-object-3\"}]"
}
Sample response
{
"RequestId": "7151955F-88E0-0FE3-9A3A-A5780276****",
"Files": [
{
"ErrorCode": "",
"ErrorMessage": "",
"URI": "oss://test-bucket/test-object-3"
}
]
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
files_0 = imm_20200930_models.AddStoryFilesRequestFiles(
uri='oss://test-bucket/test-object-3'
)
add_story_files_request = imm_20200930_models.AddStoryFilesRequest(
# Specify the following four parameters.
project_name='test-project',
dataset_name='test-dataset',
object_id='id2',
files=[
files_0
]
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.add_story_files_with_options(add_story_files_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Remove files from a story
Call the RemoveStoryFiles operation to remove files from a specific story in the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "id2",
"Files": "[{\"URI\": \"oss://test-bucket/test-object-2\"}]"
}
Sample response
{
"RequestId": "C4F402BB-AA28-0CB0-8FFF-C7EC4855****"
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
files_0 = imm_20200930_models.RemoveStoryFilesRequestFiles(
uri='oss://test-bucket/test-object-2'
)
remove_story_files_request = imm_20200930_models.RemoveStoryFilesRequest(
# Specify the following four parameters.
project_name='test-project',
dataset_name='test-dataset',
object_id='id2',
files=[
files_0
]
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.remove_story_files_with_options(remove_story_files_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Update a story
Call the UpdateStory operation to update properties such as StoryName and CustomLabels for a specific story in the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "id2",
"StoryName": "new name",
"CustomLabels": "{\"key1\": \"val1\"}",
"Cover": null
}
Sample response
{
"RequestId": "7DBA0367-4280-0D53-B48F-F228F1A5****"
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
custom_labels = {}
update_story_request = imm_20200930_models.UpdateStoryRequest(
# Specify the following five parameters.
project_name='test-project',
dataset_name='test-dataset',
object_id='id',
story_name='new name',
custom_labels={"key1": "val1"}
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.update_story_with_options(update_story_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Create a custom story
Call the CreateCustomizedStory operation to create a custom story in the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"StoryName": "name1",
"StoryType": "PeopleMemory",
"StorySubType": "Solo",
"Cover": "{\"URI\": \"oss://test-bucket/test-object\"}",
"Files": "[{\"URI\": \"oss://test-bucket/test-object-1\"}, {\"URI\": \"oss://test-bucket/test-object-2\"}, {\"URI\": \"oss://test-bucket/test-object-3\"}]",
"CustomLabels": "{\"name\": \"test\"}"
}
Sample response
{
"RequestId": "2400041F-9AA7-018E-9E34-CC178BA2****",
"ObjectId": "b5b4820d-5ca5-4beb-9b52-d7428346****"
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
custom_labels = {}
files_0 = imm_20200930_models.CreateCustomizedStoryRequestFiles(
uri='oss://test-bucket/test-object'
)
files_1 = imm_20200930_models.CreateCustomizedStoryRequestFiles(
uri='oss://test-bucket/test-object-1'
)
files_2 = imm_20200930_models.CreateCustomizedStoryRequestFiles(
uri='oss://test-bucket/test-object-2'
)
files_3 = imm_20200930_models.CreateCustomizedStoryRequestFiles(
uri='oss://test-bucket/test-object-3'
)
cover = imm_20200930_models.CreateCustomizedStoryRequestCover(
uri='oss://test-bucket/test-object'
)
create_customized_story_request = imm_20200930_models.CreateCustomizedStoryRequest(
# Specify the following eight parameters.
project_name='test-project',
dataset_name='test-dataset',
story_type='PeopleMemory',
story_sub_type='Solo',
story_name='name1',
cover=cover,
files=[
files_0, files_1, files_2, files_3
],
custom_labels=custom_labels
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.create_customized_story_with_options(create_customized_story_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Delete a story
Call the DeleteStory operation to delete a specific story from the test-dataset dataset within the test-project project.
Sample request
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "id1"
}
Sample response
{
"RequestId": "17040B87-3176-0356-8262-C8B39ABA****"
}
Sample code
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initialize the client with your AccessKey ID and AccessKey Secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# The AccessKey pair of an Alibaba Cloud account has permissions on all APIs. We recommend that you use a RAM user for API access or routine O&M.
# Do not store your AccessKey ID or AccessKey Secret in your code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
# This example shows how to use environment variables to authenticate API calls. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/2361894.html.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
# Initialize the client.
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
delete_story_request = imm_20200930_models.DeleteStoryRequest(
# Specify the following three parameters.
project_name='test-project',
dataset_name='test-dataset',
object_id='id1'
)
runtime = util_models.RuntimeOptions()
try:
# Print the returned value of the API operation after you copy and run the code.
client.delete_story_with_options(delete_story_request, runtime)
except Exception as error:
# Print error details if needed.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])