feat: ym api key
This commit is contained in:
@@ -20,13 +20,18 @@ class YandexmarketMarketplaceApi(BaseMarketplaceApi):
|
|||||||
logging.error(f"Couldn't load auth data for marketplace [{self.marketplace.id}]")
|
logging.error(f"Couldn't load auth data for marketplace [{self.marketplace.id}]")
|
||||||
self.is_valid = False
|
self.is_valid = False
|
||||||
return
|
return
|
||||||
access_token = auth_data.get('accessToken')
|
api_key = auth_data.get('apiKey')
|
||||||
|
if api_key:
|
||||||
self.limiter_key = str(marketplace.company_id) + str(access_token) + str(self.marketplace.campaign_id)
|
self.limiter_key = str(marketplace.company_id) + str(api_key) + str(self.marketplace.campaign_id)
|
||||||
|
self.headers = {
|
||||||
self.headers = {
|
'Api-Key': api_key
|
||||||
'Authorization': f'OAuth oauth_token="{access_token}", oauth_client_id="{YANDEX_CLIENT_ID}"'
|
}
|
||||||
}
|
else:
|
||||||
|
access_token = auth_data.get('accessToken')
|
||||||
|
self.limiter_key = str(marketplace.company_id) + str(access_token) + str(self.marketplace.campaign_id)
|
||||||
|
self.headers = {
|
||||||
|
'Authorization': f'OAuth oauth_token="{access_token}", oauth_client_id="{YANDEX_CLIENT_ID}"'
|
||||||
|
}
|
||||||
|
|
||||||
def get_headers(self):
|
def get_headers(self):
|
||||||
return self.headers
|
return self.headers
|
||||||
|
|||||||
Reference in New Issue
Block a user