-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
140 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
class BaseCredentials: | ||
class Credentials: | ||
def __init__(self, credentials): | ||
self.client_id = credentials.client_id | ||
self.client_secret = credentials.client_secret | ||
self.refresh_token = credentials.refresh_token | ||
|
||
|
||
class Credentials(BaseCredentials): | ||
def __init__(self, credentials): | ||
super().__init__(credentials) | ||
self.profile_id = credentials.profile_id | ||
self.client_id = credentials['client_id'] | ||
self.client_secret = credentials['client_secret'] | ||
self.refresh_token = credentials['refresh_token'] | ||
self.profile_id = credentials['profile_id'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import ad_api.version as vd | ||
from ad_api.base.credential_provider import CredentialProvider | ||
|
||
|
||
class BaseClient: | ||
scheme = 'https://' | ||
method = 'GET' | ||
content_type = 'application/x-www-form-urlencoded;charset=UTF-8' | ||
user_agent = 'python-ad-api' | ||
credential_provider_class = CredentialProvider | ||
|
||
def __init__(self, account='default', credentials=None): | ||
def __init__(self): | ||
try: | ||
version = vd.__version__ | ||
self.user_agent += f'-{version}' | ||
except: | ||
pass | ||
self.credentials = self.credential_provider_class(account, credentials).credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters