File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11"""Tests for Personal Access Token (PAT) authentication support."""
22
3- import pytest
4- from datetime import datetime , timedelta
53from unittest .mock import patch
64
75from datadog_api_client .api_client import ApiClient , Endpoint as _Endpoint
86from datadog_api_client .configuration import Configuration
9- from datadog_api_client .delegated_auth import (
10- DelegatedTokenCredentials ,
11- DelegatedTokenConfig ,
12- DelegatedTokenProvider ,
13- )
147
158
169class TestBearerTokenConfiguration :
You can’t perform that action at this time.
0 commit comments