Skip to content

Commit

Permalink
Merge pull request #159 from drewxa/main-1
Browse files Browse the repository at this point in the history
Add support for creating client using access_token only
  • Loading branch information
denisneuf authored Sep 1, 2023
2 parents b4f5045 + 581a8a2 commit 4c15cc4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ad_api/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def __init__(
proxies=None,
verify=True,
timeout=None,
debug=False
debug=False,
access_token=None,
):

self.credentials = CredentialProvider(account, credentials).credentials
Expand All @@ -43,6 +44,7 @@ def __init__(
verify=verify,
timeout=timeout,
)
self._access_token = access_token
self.endpoint = marketplace.endpoint
self.debug = debug
self.timeout = timeout
Expand All @@ -61,7 +63,7 @@ def headers(self):

@property
def auth(self) -> AccessTokenResponse:
return self._auth.get_auth()
return self._auth.get_auth() if self._access_token is None else AccessTokenResponse(access_token=self._access_token)

@staticmethod
def _download(self, params: dict = None, headers=None) -> ApiResponse:
Expand Down

0 comments on commit 4c15cc4

Please sign in to comment.