Skip to main content

The Aliyun Secrets Manager Client for Python enables Python developers to easily work with Aliyun KMS Secrets.

Read this in other languages: 简体中文 <https://github.com/aliyun/aliyun-secretsmanager-client-python/blob/master/README.zh-cn.rst>

License

Apache License 2.0

Features

  • Provide quick integration capability to gain secret information

  • Provide Alibaba secrets cache ( memory cache or encryption file cache )

  • Provide tolerated disaster by the secrets with the same secret name and secret data in different regions

  • Provide default backoff strategy and user-defined backoff strategy

Requirements

Python 2.7,3.5,3.6,3.7,3.8,3.9

Install

Install the official release version through PIP (taking Linux as an example):

$ pip install aliyun-secret-manager-client

You can also install the unzipped installer package directly:

$ sudo python setup.py install

Sample Code

Ordinary User Sample Code

from alibaba_cloud_secretsmanager_client.secret_manager_cache_client_builder import SecretManagerCacheClientBuilder

if __name__ == '__main__':
    secret_cache_client = SecretManagerCacheClientBuilder.new_client()
    secret_info = secret_cache_client.get_secret_info("#secretName#")
    print(secret_info.__dict__)
  • Build Secrets Manager Client by the given parameters(accessKey, accessSecret, regionId, etc)

import os

from alibaba_cloud_secretsmanager_client.secret_manager_cache_client_builder import SecretManagerCacheClientBuilder
from alibaba_cloud_secretsmanager_client.service.default_secret_manager_client_builder import DefaultSecretManagerClientBuilder

if __name__ == '__main__':
    secret_cache_client = SecretManagerCacheClientBuilder.new_cache_client_builder(DefaultSecretManagerClientBuilder.standard() \
        .with_access_key(os.getenv("#accessKeyId#"), os.getenv("#accessKeySecret#")) \
        .with_region("#regionId#").build()) \
    .build();
    secret_info = secret_cache_client.get_secret_info("#secretName#")
    print(secret_info.__dict__)

Particular User Sample Code

  • Use custom parameters or customized implementation

import os

from alibaba_cloud_secretsmanager_client.secret_manager_cache_client_builder import SecretManagerCacheClientBuilder
from alibaba_cloud_secretsmanager_client.cache.file_cache_secret_store_strategy import FileCacheSecretStoreStrategy
from alibaba_cloud_secretsmanager_client.service.default_secret_manager_client_builder import DefaultSecretManagerClientBuilder
from alibaba_cloud_secretsmanager_client.service.default_refresh_secret_strategy import DefaultRefreshSecretStrategy
from alibaba_cloud_secretsmanager_client.service.full_jitter_back_off_strategy import FullJitterBackoffStrategy

if __name__ == '__main__':
    secret_cache_client = SecretManagerCacheClientBuilder \
    .new_cache_client_builder(DefaultSecretManagerClientBuilder.standard().with_access_key(os.getenv("#accessKeyId#"), os.getenv("#accessKeySecret#")) \
         .with_back_off_strategy(FullJitterBackoffStrategy(3, 2000, 10000)) \
         .with_region("#regionId#").build()) \
     .with_cache_secret_strategy(FileCacheSecretStoreStrategy("#cacheSecretPath#", True,"#salt#")) \
     .with_refresh_secret_strategy(DefaultRefreshSecretStrategy("#ttlName#")) \
     .with_cache_stage("#stage#") \
     .with_secret_ttl("#secretName#", 1 * 60 * 1000l) \
     .build()
    secret_info = secret_cache_client.get_secret_info("#secretName#")
    print(secret_info.__dict__)

Release files for aliyun-secret-manager-client 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aliyun-secret-manager-client 0.1.5
File Size Uploaded
aliyun_secret_manager_client-0.1.5.tar.gz 27.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aliyun-secret-manager-client 0.1.5
File Interpreter ABI Platform
aliyun_secret_manager_client-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 77.4 kB

Release files / aliyun_secret_manager_client-0.1.5.tar.gz

Download URL aliyun_secret_manager_client-0.1.5.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
01194ce19f8ca10a0dc3477cff23fa739205e5929ba11dde31116d9f5c078449
BLAKE2b-256 checksum
How to use checksums
64383fecc50dbc894a3184fe2a305c68e8d0f07a8164b42d4907c16d298efd8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / aliyun_secret_manager_client-0.1.5-py3-none-any.whl

Download URL aliyun_secret_manager_client-0.1.5-py3-none-any.whl
Size 50.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d47f76276678d110068c628d86b3d33892618d82e38db7e61415bc763867e29e
BLAKE2b-256 checksum
How to use checksums
87cb0a3a3ef4640b0ff73199bf0023bed9e049591c19c53f9d83ffd2b86662a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page