|
@@ -66,7 +66,11 @@ class SpApiRequest:
|
|
|
else:
|
|
|
region = str(country)[-2:]
|
|
|
df = cls.auth_info()
|
|
|
- refresh_token = df.query("account_name==@account_name and region==@region")['refresh_token'].values[0]
|
|
|
+ try:
|
|
|
+ refresh_token = df.query("account_name==@account_name and region==@region")['refresh_token'].values[0]
|
|
|
+ except:
|
|
|
+ print("请输入正确的account name与Marketplace")
|
|
|
+ return '获取失败'
|
|
|
cred = {
|
|
|
'refresh_token': refresh_token,
|
|
|
'lwa_app_id': 'amzn1.application-oa2-client.1f9d3d4747e14b22b4b598e54e6b922e', # 卖家中心里面开发者资料LWA凭证
|
|
@@ -75,9 +79,10 @@ class SpApiRequest:
|
|
|
'aws_secret_key': 'OSbkKKjShvDoWGBwRORSUqDryBtKWs8AckzwNMzR',
|
|
|
'role_arn': 'arn:aws:iam::070880041373:role/Amazon_SP_API_ROLE'
|
|
|
}
|
|
|
- images_info = CatalogItems(credentials=cred, marketplace=country).get_catalog_item(asin=asin,**{"includedData":['images']})
|
|
|
+ cate_item = CatalogItems(credentials=cred, marketplace=country)
|
|
|
+ images_info = cate_item.get_catalog_item(asin=asin,**{"includedData":['images']})
|
|
|
images = images_info.images[0].get('images')[0]['link']
|
|
|
- title_info = CatalogItems(credentials=cred, marketplace=country).get_catalog_item(asin=asin)
|
|
|
+ title_info = cate_item.get_catalog_item(asin=asin)
|
|
|
title = title_info.payload['summaries'][0]['itemName']
|
|
|
return {'images':images,'title':title}
|
|
|
|