Skip to content

Commit

Permalink
Added config instance variable to LinkedInClient class and updated it…
Browse files Browse the repository at this point in the history
…'s usage.
  • Loading branch information
shantanu73 committed Nov 28, 2023
1 parent afb2d2f commit 59c5266
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tap_linkedin_ads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

def do_discover(client):
LOGGER.info('Starting discover')
client.check_accounts(client.get_config())
client.check_accounts(client.config)
catalog = _discover()
json.dump(catalog.to_dict(), sys.stdout, indent=2)
LOGGER.info('Finished discover')
Expand Down
2 changes: 2 additions & 0 deletions tap_linkedin_ads/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def __init__(self, # pylint: disable=too-many-arguments
self.__client_secret = client_secret
self.__refresh_token = refresh_token
self.__config_path = config_path
self.config = self.get_config()
self.__user_agent = user_agent
self.__access_token = access_token
self.__expires = None
Expand Down Expand Up @@ -192,6 +193,7 @@ def write_access_token_to_config(self):
config = json.load(file)
# Set new access_token
config['access_token'] = self.__access_token
self.config = config

with open(self.__config_path, 'w') as file:
json.dump(config, file, indent=2)
Expand Down
2 changes: 1 addition & 1 deletion tap_linkedin_ads/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def sync_endpoint(self,
url_list = []
if self.tap_stream_id in NEW_PATH_STREAMS:
querystring = '&'.join(['%s=%s' % (key, value) for (key, value) in endpoint_params.items()])
config = client.get_config()
config = client.config
account_list = config['accounts'].replace(" ", "").split(",")
for account in account_list:
url = '{}/adAccounts/{}/{}?{}'.format(BASE_URL, account, self.path, querystring)
Expand Down
2 changes: 1 addition & 1 deletion tap_linkedin_ads/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def sync(client, catalog, state):
"""
sync selected streams.
"""
config = client.get_config()
config = client.config
start_date = config['start_date']
page_size = get_page_size(config)

Expand Down

0 comments on commit 59c5266

Please sign in to comment.