diff options
author | rekby <rekby@ydb.tech> | 2023-03-27 14:20:28 +0300 |
---|---|---|
committer | rekby <rekby@ydb.tech> | 2023-03-27 14:20:28 +0300 |
commit | ee85675ff7a98c734339c4363733b7b2389418e0 (patch) | |
tree | 7fe598c9fe31af4cbb9b7178bd39b6b8a79670b3 | |
parent | c749f305771b334a76fe6069bb3efde650180b2e (diff) | |
download | ydb-ee85675ff7a98c734339c4363733b7b2389418e0.tar.gz |
Fix python auth documentation
-rw-r--r-- | ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md | 8 | ||||
-rw-r--r-- | ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md | 17 |
2 files changed, 13 insertions, 12 deletions
diff --git a/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md b/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md index 4bf947be72f..b3aa4d1e2df 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md +++ b/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md @@ -25,7 +25,7 @@ You can click any of the methods below to go to the source code of an example in | Access Token | [ydb.AccessTokenCredentials( token )](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/access-token-credentials) | | Metadata | [ydb.iam.MetadataUrlCredentials()](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/metadata-credentials) | | Service Account Key | [ydb.iam.ServiceAccountCredentials.from_file(</br>key_file, iam_endpoint=None, iam_channel_credentials=None )](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/service-account-credentials) | - | Determined by environment variables | `ydb.construct_credentials_from_environ()` | + | Determined by environment variables | `ydb.credentials_from_env_variables()` | - Go @@ -84,15 +84,15 @@ The following algorithm that is the same for all SDKs applies: If the last step of the algorithm is selecting the **Metadata** mode, you can deploy a working application on VMs and in {{ yandex-cloud }} Cloud Functions without setting any environment variables. -## Python SDK specifics +## Python {{ ydb-short-name }} SDK v2 (deprecated) specifics {% note warning %} -The behavior of the Python SDK differs from the one described above. +The behavior of the Python SDK v2 (deprecated) differs from the one described above. {% endnote %} -1. The algorithm for determining the authentication mode and the necessary parameters from the environment variables in the `construct_credentials_from_environ()` method differs from the one used in other SDKs: +1. For python {{ ydb-short-name }} SDK v2 the algorithm for determining the authentication mode and the necessary parameters from the environment variables in the `construct_credentials_from_environ()` method differs from the one used in other SDKs: - If the value of the `USE_METADATA_CREDENTIALS` environment variable is set to 1, the **Metadata** authentication mode is used. - Otherwise, if the value of the `YDB_TOKEN` environment variable is set, the **Access Token** authentication mode is used, where this variable value is passed. - Otherwise, if the value of the `SA_KEY_FILE` environment variable is set, the **System Account Key** authentication mode is used and the key is taken from the file whose name is specified in this variable. diff --git a/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md b/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md index e4418fa1f67..dd1eb3adc53 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md @@ -21,11 +21,11 @@ Режим | Метод ----- | ----- - Anonymous | [ydb.AnonymousCredentials()](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/anonymous-credentials) - Access Token | [ydb.AccessTokenCredentials( token )](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/access-token-credentials) + Anonymous | [ydb.AnonymousCredentials()](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/anonymous-credentials) | + Access Token | [ydb.AccessTokenCredentials( token )](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/access-token-credentials) | Metadata | [ydb.iam.MetadataUrlCredentials()](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/metadata-credentials) - Service Account Key | [ydb.iam.ServiceAccountCredentials.from_file(</br>key_file, iam_endpoint=None, iam_channel_credentials=None )](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/service-account-credentials) - Определяется по переменным окружения | `ydb.construct_credentials_from_environ()` + Service Account Key | [ydb.iam.ServiceAccountCredentials.from_file(</br>key_file, iam_endpoint=None, iam_channel_credentials=None )](https://github.com/yandex-cloud/ydb-python-sdk/tree/master/examples/service-account-credentials) | + Определяется по переменным окружения | `ydb.credentials_from_env_variables()` | - Go @@ -84,17 +84,18 @@ Наличие последним пунктом алгоритма выбора режима **Metadata** позволяет развернуть рабочее приложение на виртуальных машинах и в Cloud Functions {{ yandex-cloud }} без задания каких-либо переменных окружения. -## Особенности Python SDK +## Особенности {{ ydb-short-name }} Python SDK v2 (устаревшая версия) {% note warning %} -Поведение Python SDK отличается от описанного выше. +Поведение {{ ydb-short-name }} Python SDK v2 (устаревшая версия) отличается от описанного выше. {% endnote %} -1. Алгоритм определения режима аутентификации и необходимых параметров из переменных окружения в методе `construct_credentials_from_environ()` отличается от применяемого в других SDK: +* Алгоритм работы функции `construct_credentials_from_environ()` {{ ydb-short-name }} Python SDK v2: - Если задано значение переменной окружения `USE_METADATA_CREDENTIALS`, равное 1, то используется режим аутентификации **Metadata** - Иначе, если задано значение переменной окружения `YDB_TOKEN`, то используется режим аутентификации **Access Token**, в который передается значение данной переменной - Иначе, если задано значение переменной окружения `SA_KEY_FILE`, то используется режим аутентификации **System Account Key**, а ключ загружается из файла, имя которого указано в данной переменной - Иначе в запросах не будет добавлена информация об аутентификации. -2. В случае, если при инициализации драйвера не передан никакой объект, отвечающий за генерацию токенов, то применяется [общий порядок](#env) чтения значений переменных окружения. +* В случае, если при инициализации драйвера не передан никакой объект, отвечающий за генерацию токенов, то применяется [общий порядок](#env) чтения значений переменных окружения. + |