DataDog / datadog-api-client-python

Python client for the Datadog API

Home Page:https://datadoghq.dev/datadog-api-client-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSL Configuration Arguments Not Passed To Async Client

vxuv opened this issue · comments

commented

Describe the bug
The Async API Client is misconfigured and wont handle ssl configuration settings correctly.
Severity: Low

To Reproduce

  1. Pass a proxy to the async datadog api client or pass a have a proxy running on the system.
  2. Disable ssl verification in the configuration. configuration.verify_ssl = False
  3. Run the code

Expected behavior
Expected to not get the ssl verify error after disabling verify ssl in configuration.
configuration.verify_ssl = False

Environment and Versions (please complete the following information):
System: Macbook
Name: datadog-api-client
Version: 2.16.0

import asyncio

from datadog_api_client import ApiClient, AsyncApiClient, Configuration
from datadog_api_client.v1.api.events_api import EventsApi
from datadog_api_client.v1.model.event_create_request import EventCreateRequest

API_KEY = "..."
APPLICATION_KEY = "..."


body = EventCreateRequest(
    title="Example-Event",
    text="A text message.",
    tags=[
        "test:ExampleEvent",
    ],
)

configuration = Configuration(
    api_key={
        "apiKeyAuth": API_KEY,
        "appKeyAuth": APPLICATION_KEY,
    },
)
configuration.verify_ssl = False


async def main() -> None:
    async with AsyncApiClient(configuration) as api_client:
        api_instance = EventsApi(api_client)
        response = await api_instance.create_event(body=body)

        print(response)


if __name__ == "__main__":
    asyncio.run(main())

Pull Request: #1655