{"id":23681,"library":"esdk-obs-python","title":"Huawei OBS Python SDK","description":"The official Huawei Cloud Object Storage Service (OBS) Python SDK, providing APIs to manage buckets and objects on OBS. Current version 3.26.2 is released regularly.","status":"active","version":"3.26.2","language":"python","source_language":"en","source_url":"https://github.com/huaweicloud/huaweicloud-sdk-python-obs","tags":["huawei","obs","object-storage","cloud","sdk"],"install":[{"cmd":"pip install esdk-obs-python","lang":"bash","label":"Install SDK"}],"dependencies":[],"imports":[{"note":"The package is installed as esdk-obs-python, but import uses 'obs' module.","wrong":"from esdk_obs_python import ObsClient","symbol":"ObsClient","correct":"from obs import ObsClient"},{"note":"","wrong":"","symbol":"PutObjectHeader","correct":"from obs import PutObjectHeader"}],"quickstart":{"code":"from obs import ObsClient\nimport os\n\nak = os.environ.get('OBS_AK', '')\nsk = os.environ.get('OBS_SK', '')\nserver = os.environ.get('OBS_SERVER', 'https://your-endpoint.com')\n\nobsClient = ObsClient(access_key_id=ak, secret_access_key=sk, server=server)\n\nresp = obsClient.listBuckets()\nif resp.status < 300:\n    for bucket in resp.body.buckets:\n        print(bucket.name)\nelse:\n    print(f\"Error: {resp.errorCode} {resp.errorMessage}\")\n\nobsClient.close()","lang":"python","description":"Initialize ObsClient, list buckets, and handle errors."},"warnings":[{"fix":"Use correct import: from obs import ObsClient","message":"In v3.x, import path changed from earlier SDK versions. Use 'from obs import ObsClient', not 'from esdk_obs_python import ...'.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Always call obsClient.close() after operations, or use a context manager wrapper.","message":"The ObsClient must be closed explicitly to release resources. Not doing so can cause connection leaks.","severity":"gotcha","affected_versions":"all"},{"fix":"Inspect resp.status and handle error codes via resp.errorCode/resp.errorMessage.","message":"HTTP status codes are not Python exceptions; check resp.status < 300. Do not assume success.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from obs import ObsClient' after installing esdk-obs-python.","cause":"Installing the package but import fails because the module name is 'obs' not 'esdk_obs_python'.","error":"ModuleNotFoundError: No module named 'obs'"},{"fix":"Use ObsClient(access_key_id=ak, secret_access_key=sk, server='https://your-endpoint.com')","cause":"Using an outdated initialization pattern with region parameter; current SDK expects server URL.","error":"obs.ObsClient() got an unexpected keyword argument 'region'"},{"fix":"Check resp.status before accessing resp.body.","cause":"Resp is None or error response has no body. Usually means network/authentication failure not caught.","error":"AttributeError: 'NoneType' object has no attribute 'buckets'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}