datadog API python 授权
datadog API python auth
是否有关于如何使用 python 库 datadog_api_client.v2
向 datadog 进行身份验证的基本示例?我正在查看他们的文档 https://datadoghq.dev/datadog-api-client-python/v2/#apikeyauth,但没有看到任何我期待的示例:
import datadog_api_client.v2
import os
from datadog_api_client.v2 import list_tag_configurations
configuration = datadog_api_client.v2.Configuration(
host = "https://api.datadoghq.com"
)
configuration.api_key['apiKeyAuth'] = os.getenv('123')
with datadog_api_client.v2.ApiClient(configuration) as api_client:
api_instance = list_tag_configurations(api_client)
print(api_instance)
这是我在 datadog_api_client / v2 / configuration.py starting on line 83:
的 github repo 源代码中找到的关于如何使用 Configuration
的唯一 v2 身份验证示例
conf = datadog_api_client.v2.Configuration(
api_key={'cookieAuth': 'abc123'}
api_key_prefix={'cookieAuth': 'JSESSIONID'}
)
我的猜测是使用 v1 的示例进行身份验证,但将 v1 更改为 v2 会起作用。
这是他们的 v1 示例的第一部分,来自他们的根 github readme.md
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import aws_integration_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
下面是他们在 list_tag_configurations
上的 v2 文档中的示例:https://datadoghq.dev/datadog-api-client-python/v2/MetricsApi/#list_tag_configurations
是否有关于如何使用 python 库 datadog_api_client.v2
向 datadog 进行身份验证的基本示例?我正在查看他们的文档 https://datadoghq.dev/datadog-api-client-python/v2/#apikeyauth,但没有看到任何我期待的示例:
import datadog_api_client.v2
import os
from datadog_api_client.v2 import list_tag_configurations
configuration = datadog_api_client.v2.Configuration(
host = "https://api.datadoghq.com"
)
configuration.api_key['apiKeyAuth'] = os.getenv('123')
with datadog_api_client.v2.ApiClient(configuration) as api_client:
api_instance = list_tag_configurations(api_client)
print(api_instance)
这是我在 datadog_api_client / v2 / configuration.py starting on line 83:
的 github repo 源代码中找到的关于如何使用Configuration
的唯一 v2 身份验证示例
conf = datadog_api_client.v2.Configuration(
api_key={'cookieAuth': 'abc123'}
api_key_prefix={'cookieAuth': 'JSESSIONID'}
)
我的猜测是使用 v1 的示例进行身份验证,但将 v1 更改为 v2 会起作用。
这是他们的 v1 示例的第一部分,来自他们的根 github readme.md
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import aws_integration_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
下面是他们在 list_tag_configurations
上的 v2 文档中的示例:https://datadoghq.dev/datadog-api-client-python/v2/MetricsApi/#list_tag_configurations