{"id":23234,"library":"alibabacloud-sls20201230","title":"Alibaba Cloud Log Service SDK for Python","description":"Official Alibaba Cloud SDK for Log Service (SLS) API version 2020-12-30. Supports log ingestion, query, indexing, dashboards, and more. Current version 5.12.1 (released 2025-07-07). Release cadence is irregular, typically with minor updates monthly. Requires Python >=3.7.","status":"active","version":"5.12.1","language":"python","source_language":"en","source_url":"https://github.com/aliyun/alibabacloud-python-sdk","tags":["alibaba","cloud","sls","log-service","sdk","api"],"install":[{"cmd":"pip install alibabacloud-sls20201230","lang":"bash","label":"Install SDK"}],"dependencies":[{"reason":"Credential management and authentication","package":"alibabacloud_credentials","optional":false}],"imports":[{"note":"Client is not in top-level package; must import from client module.","wrong":"from alibabacloud_sls20201230 import Client","symbol":"Client","correct":"from alibabacloud_sls20201230.client import Client"},{"note":"Models are in models submodule.","wrong":"from alibabacloud_sls20201230 import GetLogsRequest","symbol":"GetLogsRequest","correct":"from alibabacloud_sls20201230.models import GetLogsRequest"},{"note":"Simpler to import the module.","wrong":"import alibabacloud_sls20201230.models","symbol":"models","correct":"from alibabacloud_sls20201230 import models"}],"quickstart":{"code":"import os\nfrom alibabacloud_sls20201230.client import Client\nfrom alibabacloud_sls20201230 import models\nfrom alibabacloud_credentials.client import CredentialClient\n\ncredential = CredentialClient(\n    access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),\n    access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', ''),\n)\nclient = Client(credential)\n\n# List projects\nreq = models.ListProjectRequest()\nresp = client.list_project(req)\nprint(resp.body.total)\n","lang":"python","description":"Initialize client with credentials and list projects."},"warnings":[{"fix":"Use from alibabacloud_sls20201230.client import Client instead of from aliyunsdksls.client import Client.","message":"Version 4.x to 5.x drops support for Python 2.7. Requires Python >=3.7. All imports changed to snake_case packages.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Set endpoint via client._endpoint = 'https://sls.ap-southeast-1.aliyuncs.com' or use region in credential.","message":"API endpoint must be specified for regions outside mainland China. Default endpoint (cn-hangzhou) may not work for international regions.","severity":"gotcha","affected_versions":"all"},{"fix":"Use offset and size parameters in ListLogStoreRequest to paginate.","message":"The list_logstore method returns only 100 log stores by default. Pagination must be handled manually if more exist.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"from alibabacloud_sls20201230.client import Client","cause":"Client is not imported correctly; must import from client module.","error":"AttributeError: module 'alibabacloud_sls20201230' has no attribute 'Client'"},{"fix":"Ensure ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set correctly.","cause":"Access credentials are incorrect or not properly set via environment variables.","error":"SDKError: InvalidAccessKeySecret. Specified access key secret is not valid."},{"fix":"Check endpoint configuration and ensure project exists. Validate response before accessing fields.","cause":"Response may be empty if project does not exist or endpoint is wrong.","error":"Exception: 'NoneType' object has no attribute 'total'"},{"fix":"Use Python >=3.7. For Python 2, stick to alibabacloud-sls20201230 <5.0.0.","cause":"Python 2 compatibility issue; only relevant when using Python 2 (unsupported on >=5.x).","error":"UnicodeEncodeError: 'ascii' codec can't encode characters"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}