Skip to content

Commit 3c7c23c

Browse files
committed
CRED-2146: Regenerated client code from templates
1 parent 9bc92a2 commit 3c7c23c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/datadog_api_client/configuration.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ def __init__(
478478
self.api_key["apiKeyAuth"] = os.environ["DD_API_KEY"]
479479
if "DD_APP_KEY" in os.environ and not self.api_key.get("appKeyAuth"):
480480
self.api_key["appKeyAuth"] = os.environ["DD_APP_KEY"]
481+
if "DD_BEARER_TOKEN" in os.environ and not self.access_token:
482+
self.access_token = os.environ["DD_BEARER_TOKEN"]
481483

482484
def __deepcopy__(self, memo):
483485
cls = self.__class__
@@ -777,4 +779,11 @@ def auth_settings(self):
777779
"appKeyAuth",
778780
),
779781
}
782+
if self.access_token is not None:
783+
auth["bearerAuth"] = {
784+
"type": "bearer",
785+
"in": "header",
786+
"key": "Authorization",
787+
"value": "Bearer " + self.access_token,
788+
}
780789
return auth

tests/test_pat_auth.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
"""Tests for Personal Access Token (PAT) authentication support."""
22

3-
import pytest
4-
from datetime import datetime, timedelta
53
from unittest.mock import patch
64

75
from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
86
from datadog_api_client.configuration import Configuration
9-
from datadog_api_client.delegated_auth import (
10-
DelegatedTokenCredentials,
11-
DelegatedTokenConfig,
12-
DelegatedTokenProvider,
13-
)
147

158

169
class TestBearerTokenConfiguration:

0 commit comments

Comments
 (0)