Update a project
Call the UpdateProject API to modify the project's description.
Prerequisites
Simple Log Service is activated.
Simple Log Service SDK for Python is initialized.
Parameter description
def update_project(self, project_name, project_des):Request parameters
Parameter | Type | Required | Description |
project_name | String | Yes | The name of the project. The name must be globally unique. You cannot change the name after you create the project. The name must meet the following requirements:
|
project_des | String | Yes | Description of the project. The description must not contain angle brackets (<>), apostrophes ('), backslashes (\), double quotes ("), or double backslashes (\\). It can contain up to 64 characters. |
Response parameters
For more information, see UpdateProject.
Sample code
from aliyun.log import LogClient
import os
# In this example, the AccessKey ID and AccessKey secret are obtained from environment variables.
access_key_id = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
access_key_secret = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
# The Simple Log Service endpoint.
endpoint = "cn-hangzhou.log.aliyuncs.com"
client = LogClient(endpoint, access_key_id, access_key_secret)
# Project name
project_name = "slsproject-1"
# Project description
project_des = "test project"
# Update the project description.
def main():
try:
res = client.update_project(project_name, project_des)
res.log_print()
# If an exception is thrown, the update fails. Handle the exception.
except Exception:
print("Update Project failed.")
if __name__ == '__main__':
main()
Sample response
UpdateProjectResponse:
headers: {'Server': 'AliyunSLS', 'Content-Length': '0', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Date': 'Wed, 20 Nov 2024 06:07:30 GMT', 'x-log-time': '1732082850', 'x-log-requestid': '673D7CA1B18EF88B8201****'}
Process finished with exit code 0References
For more code samples, see aliyun-log-python-sdk on GitHub.
For more information about project-related API operations, see the following topics: