Skip to main content

Collection of all Datadog Public endpoints

Project description

datadog-api-client-python

This repository contains a Python API client for the Datadog API. The code is generated using openapi-generator and apigentools.

Requirements

Building and using the API client library requires Python 3.6+.

Installation

To install the API client library, simply execute:

pip install datadog-api-client

Getting Started

Please follow the installation instruction and execute the following Python code:

import os
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')

# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = aws_integration_api.AWSIntegrationApi(api_client)
    body = AWSAccount(
        access_key_id="access_key_id_example",
        account_id="1234567",
        account_specific_namespace_rules={
            "key": True,
        },
        excluded_regions=["us-east-1","us-west-2"],
        filter_tags=["<KEY>:<VALUE>"],
        host_tags=["<KEY>:<VALUE>"],
        role_name="DatadogAWSIntegrationRole",
        secret_access_key="secret_access_key_example",
    ) # AWSAccount | AWS Request Object

    # example passing only required values which don't have defaults set
    try:
        # Create an AWS integration
        api_response = api_instance.create_aws_account(body)
        pprint(api_response)
    except datadog_api_client.v1.ApiException as e:
        print("Exception when calling AWSIntegrationApi->create_aws_account: %s\n" % e)

Unstable Endpoints

This client includes access to Datadog API endpoints while they are in an unstable state and may undergo breaking changes. An extra configuration step is required to enable these endpoints:

configuration.unstable_operations["<OperationName>"] = True

where <OperationName> is the name of the method used to interact with that endpoint. For example: list_log_indexes, or get_logs_index

Changing Server

When talking to a different server, like the eu instance, change the server_variables on your configuration object:

configuration.server_variables["site"] = "datadoghq.eu"

Disable compressed payloads

If you want to disable GZIP compressed responses, set the compress flag on your configuration object:

configuration.compress = False

Enable requests tracing

If you want to enable requests tracing, set the debug flag on your configuration object:

configuration.debug = True

Documentation for API Endpoints and Models

Documentation for API endpoints and models can be found under the docs subdirectories, in v1 and v2.

It's also available on readthedocs.

Documentation for Authorization

Authenticate with the API by providing your API and Application keys in the configuration:

configuration.api_key["apiKeyAuth"] = "YOUR_API_KEY"
configuration.api_key["appKeyAuth"] = "YOUR_APPLICATION_KEY"

Author

support@datadoghq.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

datadog_api_client-1.7.0-py2.py3-none-any.whl (2.2 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file datadog_api_client-1.7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: datadog_api_client-1.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for datadog_api_client-1.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f874dab0d4d182132122cfcc70c549b5314817913a80ba0d80a837952327dd9d
MD5 933ecedf8a676198a144be5a668a3992
BLAKE2b-256 5f494e923704ef4bc9473e33a811bf6fa1a6167b65d641e37645f2d6d67e07de

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page