Metadata-Version: 2.1
Name: datadog-api-client
Version: 1.8.0
Summary: Collection of all Datadog Public endpoints
Home-page: https://github.com/DataDog/datadog-api-client-python
Author: Datadog, Inc.
Author-email: packages@datadoghq.com
License: BSD
Project-URL: Bug Tracker, https://github.com/DataDog/datadog-api-client-python/issues
Project-URL: Documentation, https://docs.datadoghq.com/api/
Project-URL: Source Code, https://github.com/DataDog/datadog-api-client-python
Keywords: openapi,api,client,openapi-generator,datadog
Platform: any
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE-3rdparty.csv
License-File: NOTICE
Requires-Dist: urllib3 (>=1.15)
Requires-Dist: six (>=1.10)
Requires-Dist: certifi
Requires-Dist: python-dateutil
Provides-Extra: apm
Requires-Dist: ddtrace ; extra == 'apm'
Provides-Extra: async
Requires-Dist: aiosonic ; extra == 'async'
Provides-Extra: tests
Requires-Dist: aiosonic ; extra == 'tests'
Requires-Dist: glom ; extra == 'tests'
Requires-Dist: flexmock (>=0.10.4) ; extra == 'tests'
Requires-Dist: freezegun ; extra == 'tests'
Requires-Dist: jinja2 ; extra == 'tests'
Requires-Dist: pytest ; extra == 'tests'
Requires-Dist: pytest-bdd (==4.0.2) ; extra == 'tests'
Requires-Dist: pytest-asyncio ; extra == 'tests'
Requires-Dist: pytest-randomly ; extra == 'tests'
Requires-Dist: pytest-recording ; extra == 'tests'
Requires-Dist: python-dateutil ; extra == 'tests'

# datadog-api-client-python

This repository contains a Python API client for the [Datadog API](https://docs.datadoghq.com/api/).
The code is generated using [openapi-generator](https://github.com/OpenAPITools/openapi-generator)
and [apigentools](https://github.com/DataDog/apigentools).

## Requirements

Building and using the API client library requires [Python 3.6+](https://www.python.org/downloads/).

## Installation

To install the API client library, simply execute:

```shell
pip install datadog-api-client
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Python code:

```python
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:

```python
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:

```python
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:

```python
configuration.compress = False
```

### Enable requests logging

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

```python
configuration.debug = True
```

### Asyncio support

The library supports asynchronous operations when using `AsyncApiClient` for the transport. When that client is used,
the API methods will then return coroutines that you can wait for.

To make async support available, you need to install the extra `async` qualifiers during installation: `pip install datadog-api-client[async]`.


```python
import asyncio

from datadog_api_client.v1 import Configuration, AsyncApiClient
from datadog_api_client.v1.api import dashboards_api

async def main():
    configuration = Configuration()
    async with AsyncApiClient(configuration) as api_client:
        api_instance = dashboards_api.DashboardsApi(api_client)
        dashbooards = await api_instance.list_dashboards()
        print(dashbooards)

asyncio.run(main())
```

## Documentation for API Endpoints and Models

Documentation for API endpoints and models can be found under the docs subdirectories, in [v1](/docs/v1#documentation-for-api-endpoints) and [v2](/docs/v2#documentation-for-api-endpoints).

It's also available on [readthedocs](https://datadog-api-client.readthedocs.io/).

## Documentation for Authorization

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

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

## Author

support@datadoghq.com



