Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_amazon_product_api(self):
"""
Create an instance of product api
:return: Product API instance
"""
return mws.Products(
access_key=self.amazon_access_key,
secret_key=self.amazon_secret_key,
account_id=self.amazon_merchant_id,
)
def get_mws_api(self):
"""
Create an instance of mws api
:return: mws api instance
"""
return mws.MWS(
access_key=self.amazon_access_key,
secret_key=self.amazon_secret_key,
account_id=self.amazon_merchant_id,
)
def get_amazon_order_api(self):
"""
Create an instance of Order api
:return: order api instance
"""
return mws.Orders(
access_key=self.amazon_access_key,
secret_key=self.amazon_secret_key,
account_id=self.amazon_merchant_id,
)
def get_amazon_feed_api(self):
"""
Return an instance of feed api
"""
return mws.Feeds(
access_key=self.amazon_access_key,
secret_key=self.amazon_secret_key,
account_id=self.amazon_merchant_id,
)
:param data: Wizard data
"""
SaleChannel = Pool().get('sale.channel')
channel = SaleChannel(Transaction().context.get('active_id'))
channel.validate_amazon_channel()
res = {}
api = channel.get_amazon_feed_api()
try:
api.get_feed_submission_count().parsed
res['status'] = 'Account settings have been configured correctly'
except mws.MWSError:
res['status'] = "Something went wrong. Please check account " + \
"settings again"
return res
from __future__ import absolute_import
import mws
import time
from datetime import datetime, timedelta
from . import config
from . import util
from . import queries
orders_api = mws.Orders(
access_key=config.access_key,
secret_key=config.secret_key,
account_id=config.seller_id,
auth_token=config.mws_auth_token,
region='US' or config.country_code,
)
yesterday = datetime.now() - timedelta(hours=24)
def get_order_id(order):
return order.get('AmazonOrderId').get('value')
def parse_order_safely(order):
if order.parsed.Orders:
from __future__ import absolute_import
import mws
from . import config
from . import util
orders_api = mws.Orders(
access_key=config.access_key,
secret_key=config.secret_key,
account_id=config.seller_id,
region='US' or config.country_code,
)
def get_order_id(order):
return order.get('AmazonOrderId').get('value')
class Orders(object):
def __init__(self, last_updated_after, marketplace_id=None):
self.api = orders_api
self.marketplace_id = marketplace_id or config.marketplace_id
self.last_updated_after = last_updated_after