Query a project

Updated at:

The GetProject operation retrieves information about a specified project, including its description, Alibaba Cloud account, region, resource group ID, and storage redundancy type.

Prerequisites

Parameter description

def get_project(self, project_name):

Request parameters

Parameter

Type

Required

Description

project_name

String

Yes

The name of the project. The project in Simple Log Service is used to isolate the resources of different users and control access to specific resources. See Manage projects.

Response parameters

For more information, see GetProject.

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 = "proj-test-1"


# Obtain information about the specified project.
def main():
    try:
        res = client.get_project(project_name)
        res.log_print()
    except Exception as error:
        print(error)


if __name__ == '__main__':
    main()

Sample response

GetProjectResponse:
headers: {'Server': 'AliyunSLS', 'Content-Type': 'application/json', 'Content-Length': '657', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 24 Oct 2024 06:37:03 GMT', 'x-log-time': '1729751823', 'x-log-requestid': '6719EB0F983EA3538A1B****'}
owner:1984****
project:proj-test-1
description:this is a project created from ide.
region:cn-hangzhou
status:Normal
create_time:2024-09-24 10:21:48
last_modify_time:2024-09-24 10:21:48
resource_group_id:rg-ac****
dataRedundancyType:LRS

References