Exemplo n.º 1
0
 def test_sandboxify(self):
     # Create one-off connection class that has self._sandboxed = True
     conn = MWSConnection(https_connection_factory=self.https_connection_factory,
         aws_access_key_id='aws_access_key_id',
         aws_secret_access_key='aws_secret_access_key',
         sandbox=True)
     self.assertEqual(conn._sandboxify('a/bogus/path'), 'a/bogus_Sandbox/path')
Exemplo n.º 2
0
 def test_sandboxify(self):
     # Create one-off connection class that has self._sandboxed = True
     conn = MWSConnection(https_connection_factory=self.https_connection_factory,
         aws_access_key_id='aws_access_key_id',
         aws_secret_access_key='aws_secret_access_key',
         sandbox=True)
     self.assertEqual(conn._sandboxify('a/bogus/path'), 'a/bogus_Sandbox/path')
def amazonbarcodesearch(list, mkt, idtype):
    '''
    
    :param list: list of barcodes to search inside Amazon
    :param mkt: Marketplace ID
    :param idtype: Barcode Type, EG UPC, EAN
    :return: List of results

    Amazon Marketplace	MarketplaceId
    DE	                A1PA6795UKMFR9
    ES	                A1RKKUPIHCS9HS
    FR	                A13V1IB3VIYZZH
    IT	                APJ6JRA9NG5V4
    UK	                A1F83G8C2ARO7P
    
    '''

    counter = 1
    results = []
    # Provide credentials
    conn = MWSConnection(
        aws_access_key_id="",  #add your access_key_id
        aws_secret_access_key="",  #add your secret_access_key
        Merchant="",  #add your merchant id
        host=""  #add your host
    )

    while len(list) > 0:
        # Get a list of orders.
        response = conn.get_matching_product_for_id(
            IdType=idtype,
            # Can only search 5 barcodes at a time
            IdList=list[0:5],
            MarketplaceId=mkt)

        product = response.GetMatchingProductForIdResult
        print(product)

        for value in product:
            status = value['status']
            barcode = value['Id']

            if status != 'Success':
                results.append(
                    "There is no matching Amazon product for item with {}: {}".
                    format(idtype, barcode))
            else:
                itemtitle = unidecode(value.Products.Product[0].AttributeSets.
                                      ItemAttributes[0].Title)
                asin = value.Products.Product[
                    0].Identifiers.MarketplaceASIN.ASIN
                results.append(
                    "Found match for Linnworks Item: {}.  {}: {} with matching ASIN: {}"
                    .format(itemtitle, idtype, barcode, asin))

        list = list[5:]
        counter += 1

    return results
Exemplo n.º 4
0
 def __init__(self, ReportType):
     self.simple = SIMPLE
     self.shack = SHACK
     self.mws = MWSConnection(Merchant=self.simple,
                              aws_access_key_id=ID,
                              aws_secret_access_key=SECRET)
     self.ProcessingStatus = None
     # self.ReportType = '_GET_FBA_MYI_ALL_INVENTORY_DATA_'
     self.ReportType = ReportType
     self.Report = None
     self.GeneratedReportId = None
     self.hasNext = False
     self.nextToken = None
     self.ReportRequestList = None
     self.ReportList = None
     self.ReportRequestId = None
Exemplo n.º 5
0
 def _get_connection(self):
     self.ensure_one()
     account = self._get_existing_keychain()
     try:
         return MWSConnection(self.accesskey,
                              account.get_password(),
                              Merchant=self.merchant,
                              host=self.host)
     except Exception as e:
         raise UserError(u"Amazon response:\n\n%s" % e)
Exemplo n.º 6
0
 def connection(self):
     """
     Share the connection between the streams,
     but only establish it when we need it - lazy loading
     This may be overkill
     """
     if not self._connection:
         self._connection = MWSConnection(
             aws_access_key_id=self.config.get('aws_access_key'),
             aws_secret_access_key=self.config.get('client_secret'),
             Merchant=self.config.get('seller_id'),
             # mws_auth_token=self.config.get('mws_auth_token'),
         )
     return self._connection
Exemplo n.º 7
0
class Build(object):
    def __init__(self, ReportType):
        self.simple = SIMPLE
        self.shack = SHACK
        self.mws = MWSConnection(Merchant=self.simple,
                                 aws_access_key_id=ID,
                                 aws_secret_access_key=SECRET)
        self.ProcessingStatus = None
        # self.ReportType = '_GET_FBA_MYI_ALL_INVENTORY_DATA_'
        self.ReportType = ReportType
        self.Report = None
        self.GeneratedReportId = None
        self.hasNext = False
        self.nextToken = None
        self.ReportRequestList = None
        self.ReportList = None
        self.ReportRequestId = None

    def get_report(self):
        # Step 1 request report
        response = self.mws.request_report(MarketplaceId=self.shack,
                                           ReportType=self.ReportType)
        # Step 2 Get ReportRequestId
        self.ReportRequestId = response.RequestReportResult.\
            ReportRequestInfo.ReportRequestId
        # Step 3 Get  GetReportRequestList, Get report processing status
        # Wait untill Done
        while self.ProcessingStatus != '_DONE_' and \
                self.ProcessingStatus != '_CANCELLED_':
            self.ReportRequestList = self.mws.get_report_request_list(
                ReportRequestIdList=[self.ReportRequestId])
            self.ProcessingStatus = self.ReportRequestList.\
                GetReportRequestListResult.ReportRequestInfo[0].\
                ReportProcessingStatus
            print self.ProcessingStatus
            if self.ProcessingStatus == '_SUBMITTED_':
                time.sleep(15)
        # Step 4 - Get Generated Report Id
        if self.ProcessingStatus == '_CANCELLED_':
            self.ReportList = self.mws.get_report_list(
                ReportTypeList=[self.ReportType])
            for item in self.ReportList.GetReportListResult.ReportInfo:
                self.ReportRequestId = item.ReportRequestId
                self.ReportRequestList = self.mws.get_report_request_list(
                    ReportRequestIdList=[self.ReportRequestId])
                self.GeneratedReportId = self.ReportRequestList.\
                    GetReportRequestListResult.\
                    ReportRequestInfo[0].GeneratedReportId
                break
        else:
            self.GeneratedReportId = self.ReportRequestList.\
                GetReportRequestListResult.ReportRequestInfo[0].\
                GeneratedReportId
        # Step7 - Get Report
        self.Report = self.mws.get_report(ReportId=self.GeneratedReportId)
        # Step 8 - Process Report and save it as csv

    def write_report_data(self, name):
        if self.Report is not None:
            conn = S3Connection(AWSACCESS, AWSSECRET)
            bucket = conn.get_bucket('invntry-rprt')
            key = Key(bucket)
            key.key = '{0}_report.txt'.format(name)
            key.set_contents_from_string(self.Report)
        else:
            return "Error, No Report Found!  Please get_inventory_report First"
        return
Exemplo n.º 8
0
# -*- coding: utf-8 -*-
#
from decimal import Decimal
from pprint import pprint

from boto.mws.connection import MWSConnection

MERCHANT_ID = "A27MO42EOV27PG"
MARKETPLACE_ID_AMAZON_DE = "A1PA6795UKMFR9"

mws = MWSConnection(Merchant=MERCHANT_ID)
mws.host = 'mws.amazonservices.de'

DATES = [("2014-09-01T00:00:00Z", "2014-10-01T00:00:00Z"),
         ("2014-10-01T00:00:00Z", "2014-11-01T00:00:00Z"),
         ("2014-11-01T00:00:00Z", "2014-11-22T00:00:00Z")]

for start, end in DATES:
    response = mws.list_orders(CreatedAfter=start,
                               CreatedBefore=end,
                               MarketplaceId=[MARKETPLACE_ID_AMAZON_DE, ])

    number_of_orders = len(response.ListOrdersResult.Orders.Order)
    total_order_sum = 0

    for order in response.ListOrdersResult.Orders.Order:
        print
        print order.AmazonOrderId, order.PurchaseDate, order.OrderTotal
        pprint(order)

        if order.OrderTotal is not None:
Exemplo n.º 9
0
count = 0

#payload = {'amazonorderid':'123123123123'}

url = 'https://api.fieldbook.com/v1/56733a810c342f030073c9d9/orders'
itemUrl = 'https://api.fieldbook.com/v1/56733a810c342f030073c9d9/orderitems'

headers = {'content-type': 'application/json', 'accept': 'application/json'}

accessKey = "accessKey"
merchantID = "merchantID"
marketplaceID = "marketplaceID"
secretKey = "secretKey"

mws = MWSConnection(accessKey, secretKey)
mws.Merchant = merchantID
mws.SellerId = merchantID
mws.MarketplaceId = marketplaceID

while month < 13:
    response = mws.list_orders(CreatedAfter='2015-12-01T00:00:00Z',
                               MarketplaceId=[marketplaceID])
    #if month>9:
    #response = mws.list_orders(CreatedAfter = '2015-10-01T00:00:00Z', MarketplaceId = [marketplaceID])

    orders = response.ListOrdersResult.Orders.Order

    for order in orders:
        payload = {
            'amazonorderid':
Exemplo n.º 10
0
class MWSTestCase(unittest.TestCase):
    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        try:
            return self._marketplace
        except AttributeError:
            response = self.mws.list_marketplace_participations()
            result = response.ListMarketplaceParticipationsResult
            self._marketplace = result.ListMarketplaces.Marketplace[0]
            return self.marketplace

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(
            MarketplaceId=self.marketplace_id, ASIN=asin)
        self.assertEqual(len(response._result.Self), 3)
        categoryids = [x.ProductCategoryId for x in response._result.Self]
        self.assertSequenceEqual(categoryids, ['285856', '21', '491314'])

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(
            MarketplaceId=self.marketplace_id, Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(
            MarketplaceId=self.marketplace_id, ASINList=[asin])
        attributes = response._result[0].Product.AttributeSets.ItemAttributes
        self.assertEqual(attributes[0].Label, 'Serengeti')

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product_for_id(self):
        asins = ['B001UDRNHO', '144930544X']
        response = self.mws.get_matching_product_for_id(
            MarketplaceId=self.marketplace_id, IdType='ASIN', IdList=asins)
        self.assertEqual(len(response._result), 2)
        for result in response._result:
            self.assertEqual(len(result.Products.Product), 1)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin])
        listings = response._result[0].Product.LowestOfferListings
        self.assertTrue(len(listings.LowestOfferListing))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_inventory_supply(self):
        asof = (datetime.today() - timedelta(days=30)).isoformat()
        response = self.mws.list_inventory_supply(QueryStartDateTime=asof,
                                                  ResponseGroup='Basic')
        self.assertTrue(hasattr(response._result, 'InventorySupplyList'))
Exemplo n.º 11
0
Arquivo: test.py Projeto: 2uinc/boto
 def __init__(self, *args, **kw):
     TestCase.__init__(self, *args, **kw)
     self.mws = MWSConnection(Merchant=simple, debug=0)
Exemplo n.º 12
0
# -*- coding: utf-8 -*-
#
import logging

from boto.mws.connection import MWSConnection

from m13.sale.models import Address, Marketplace, Order

MERCHANT_ID = "A27MO42EOV27PG"

mws = MWSConnection(Merchant=MERCHANT_ID)
mws.host = 'mws.amazonservices.de'


log = logging.getLogger(__name__)


def get_list_of_orders(marketplace_name, start_datetime, end_datetime):

    marketplace_id_list = Marketplace.objects.filter(name=marketplace_name) \
                                             .values_list('vendor_id', flat=True)
    print("   marketplace_id_list: {}".format(marketplace_id_list))
    print("   start: {}".format(start_datetime))
    print("   end: {}".format(end_datetime))
    response = mws.list_orders(CreatedAfter=start_datetime,
                               CreatedBefore=end_datetime,
                               MarketplaceId=marketplace_id_list)

    '''
    from pprint import pprint
    number_of_orders = len(response.ListOrdersResult.Orders.Order)
Exemplo n.º 13
0
class MWSTestCase(unittest.TestCase):

    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        return result.ListMarketplaces.Marketplace[0]

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(
            MarketplaceId=self.marketplace_id,
            ASIN=asin)
        result = response._result
        self.assertTrue(int(result.Self.ProductCategoryId) == 21)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(
            MarketplaceId=self.marketplace_id,
            Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(
            MarketplaceId=self.marketplace_id,
            ASINList=[asin])
        attributes = response._result[0].Product.AttributeSets.ItemAttributes
        self.assertEqual(attributes[0].Label, 'Serengeti')

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product_for_id(self):
        asins = ['B001UDRNHO', '144930544X']
        response = self.mws.get_matching_product_for_id(
            MarketplaceId=self.marketplace_id,
            IdType='ASIN',
            IdList=asins)
        self.assertEqual(len(response._result), 2)
        for result in response._result:
            self.assertEqual(len(result.Products.Product), 1)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin])
        listings = response._result[0].Product.LowestOfferListings
        self.assertTrue(len(listings.LowestOfferListing))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_inventory_supply(self):
        asof = (datetime.today() - timedelta(days=30)).isoformat()
        response = self.mws.list_inventory_supply(QueryStartDateTime=asof,
                                                  ResponseGroup='Basic')
        self.assertTrue(hasattr(response._result, 'InventorySupplyList'))
Exemplo n.º 14
0
from boto.mws.connection import MWSConnection
import csv
import cred
import importtos3
import datetime
MarketPlaceID = cred.marketplaceid()
MerchantID = cred.merchantid()
AccessKeyID = cred.accessid()
SecretKey = cred.secretkey()

mws = MWSConnection(AccessKeyID, SecretKey)

mws.SellerId = MerchantID
mws.Merchant = MerchantID
mws.MarketplaceId = MarketPlaceID


def Flat_File_Open_Listings_Data(yesterday, tomorrow):
    d = mws.get_report_request_list(
        MaxCount=1,
        ReportTypeList=['_GET_FLAT_FILE_OPEN_LISTINGS_DATA_'],
        RequestedFromDate=yesterday,
        RequestedToDate=tomorrow)
    data = ""
    for i in d.GetReportRequestListResult.ReportRequestInfo:
        #print "\n\n----------------",i.ReportType,i.GeneratedReportId,"-------------------------"

        if (i.ReportType != "FeedSummaryReport"):
            reportid = str(i.GeneratedReportId)
            report = mws.get_report(ReportId=reportid)
Exemplo n.º 15
0
Arquivo: test.py Projeto: Kixeye/boto
class MWSTestCase(unittest.TestCase):
    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ("GREEN", "GREEN_I", "YELLOW", "RED"))

    @property
    def marketplace(self):
        try:
            return self._marketplace
        except AttributeError:
            response = self.mws.list_marketplace_participations()
            result = response.ListMarketplaceParticipationsResult
            self._marketplace = result.ListMarketplaces.Marketplace[0]
            return self.marketplace

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = "144930544X"
        response = self.mws.get_product_categories_for_asin(MarketplaceId=self.marketplace_id, ASIN=asin)
        self.assertEqual(len(response._result.Self), 3)
        categoryids = [x.ProductCategoryId for x in response._result.Self]
        self.assertSequenceEqual(categoryids, ["285856", "21", "491314"])

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(MarketplaceId=self.marketplace_id, Query="boto")
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = "B001UDRNHO"
        response = self.mws.get_matching_product(MarketplaceId=self.marketplace_id, ASINList=[asin])
        attributes = response._result[0].Product.AttributeSets.ItemAttributes
        self.assertEqual(attributes[0].Label, "Serengeti")

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product_for_id(self):
        asins = ["B001UDRNHO", "144930544X"]
        response = self.mws.get_matching_product_for_id(MarketplaceId=self.marketplace_id, IdType="ASIN", IdList=asins)
        self.assertEqual(len(response._result), 2)
        for result in response._result:
            self.assertEqual(len(result.Products.Product), 1)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = "144930544X"
        response = self.mws.get_lowest_offer_listings_for_asin(
            MarketplaceId=self.marketplace_id, ItemCondition="New", ASINList=[asin]
        )
        listings = response._result[0].Product.LowestOfferListings
        self.assertTrue(len(listings.LowestOfferListing))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_inventory_supply(self):
        asof = (datetime.today() - timedelta(days=30)).isoformat()
        response = self.mws.list_inventory_supply(QueryStartDateTime=asof, ResponseGroup="Basic")
        self.assertTrue(hasattr(response._result, "InventorySupplyList"))
Exemplo n.º 16
0
#results = sql.executeScriptsFromFile('N:\Planning\John\SQL Queries\Python Queries\\sql_test_files.sql')
#print "hello world"

today = datetime.datetime.now()
#print today.strftime("%Y-%m-%d")
#exit()
AccessKeyID = 'ACCESS KEY'
SecretKey = 'SECRET KEY'


merchant_id = 'MERCHANT ID'
marketplaceId = 'MARKETPLACE ID'


conn = MWSConnection(AccessKeyID,SecretKey)
conn.SellerId = 'SELLER ID'
conn.Merchant = MERCHANT NAME'
conn.MarketplaceId = 'MARKETPLACE' #https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html


#variants = tera.runQuery("select * from fanzz_labs.js_upc_amazon") #where upc = '190528763607'

#print variants

#variants = [190528763294, 190528763379]
        
ASINLIST = tera.runQuery('''select 


m.amz_asin
Exemplo n.º 17
0
from boto.mws.connection import MWSConnection
import time
import datetime

###################################
#Return a result set
###################################

today = datetime.datetime.now()
print today.strftime("%Y-%m-%d")

AccessKeyID = 'ACCESS KEY'
merchant_id = 'MERCHANT ID'
SecretKey = 'SECRET KEY'
conn = MWSConnection(AccessKeyID, SecretKey)
conn.SellerId = 'SELLER ID'
conn.Merchant = 'MERCHANT NAME'
conn.MarketplaceId = 'MARKETPLACE ID'
marketplaceId = 'MARKETPLACE ID'

result = conn.list_inventory_supply(
    QueryStartDateTime='2017-07-01')  #Gets First Page
r = result.ListInventorySupplyResult.InventorySupplyList
inventory = []
for item in r:
    print item
    #exit()
    oh_units = item.InStockSupplyQuantity
    ttl_units = item.TotalSupplyQuantity
    ASIN = item.ASIN
Exemplo n.º 18
0
from itertools import zip_longest
import time
from attributes import Attributes
from boto.exception import BotoServerError
from multiprocessing import Pool
import os
import csv

# AWS Credentials
aws_access_key_id = os.environ.get('aws_access_key_id')
aws_secret_access_key = os.environ.get('aws_secret_access_key')
sellerid = os.environ.get('sellerid')
marketplaceid = os.environ.get('marketplaceid')

mws = MWSConnection(aws_access_key_id=aws_access_key_id,
                    aws_secret_access_key=aws_secret_access_key,
                    Merchant=sellerid)


def get_attributes(asin_list):
    '''
    Retrieve certain attributes for all active ASINS from goodstuff database

    Args:
       asin_list(list of lists):
       Each internal list contains 10 ASIN.  This because the mws function
       allows to submit an api request for 10 ASIN at a time.

    Returns:
        master(list): A list of attributes for each ASIN.
        The attributes are:
Exemplo n.º 19
0
#Return a result set
###################################

#results = sql.executeScriptsFromFile('N:\Planning\John\SQL Queries\Python Queries\\sql_test_files.sql')
#print "hello world"

today = datetime.datetime.now()
#print today.strftime("%Y-%m-%d")
#exit()
AccessKeyID = 'ACCESS KEY'
SecretKey = 'SECRET KEY'

merchant_id = 'SELLER ID'
marketplaceId = 'MARKETPLACE'

conn = MWSConnection(AccessKeyID, SecretKey)
conn.SellerId = 'SELLER ID'
conn.Merchant = 'MERCHANT NAME'
conn.MarketplaceId = 'MARKETPLACE'  #https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html

variants = tera.runQuery(
    "select * from list_of_top_sellers  where sales >= '1000' "
)  #where upc = '190528763607'

#print variants

#variants = [190528763294, 190528763379]

print type(variants)
x = 0
records = len(variants)
Exemplo n.º 20
0
import boto
from boto.mws.connection import MWSConnection

MarketPlaceID = 'MARKETPLACE_ID'
MerchantID = 'MERCHANT_ID'
AccessKeyID = 'ACCESS_KEY'
SecretKey = 'SECRET_KEY'

conn = MWSConnection(
    aws_access_key_id=AccessKeyID,
    aws_secret_access_key=SecretKey)

conn.SellerId = MerchantID
conn.Merchant = MerchantID
conn.MarketplaceId = MarketPlaceID

request = conn.list_inventory_supply(QueryStartDateTime='2015-04-01')
Exemplo n.º 21
0
 def setUp(self):
     self.mws = MWSConnection(Merchant=simple, debug=0)
Exemplo n.º 22
0
 def __init__(self, *args, **kw):
     TestCase.__init__(self, *args, **kw)
     self.mws = MWSConnection(Merchant=simple, debug=0)
Exemplo n.º 23
0
Arquivo: test.py Projeto: 2uinc/boto
class MWSTestCase(TestCase):

    def __init__(self, *args, **kw):
        TestCase.__init__(self, *args, **kw)
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        return result.ListMarketplaces.Marketplace[0]

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(\
            MarketplaceId=self.marketplace_id,
            ASIN=asin)
        result = response._result
        self.assertTrue(int(result.Self.ProductCategoryId) == 21)

    @skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(\
            MarketplaceId=self.marketplace_id,
            Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(\
            MarketplaceId=self.marketplace_id,
            ASINList=[asin,])
        product = response._result[0].Product


    @skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(\
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin,])
        product = response._result[0].Product
        self.assertTrue(product.LowestOfferListings)
Exemplo n.º 24
0
class MWSTestCase(unittest.TestCase):

    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        return result.ListMarketplaces.Marketplace[0]

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(\
            MarketplaceId=self.marketplace_id,
            ASIN=asin)
        result = response._result
        self.assertTrue(int(result.Self.ProductCategoryId) == 21)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(\
            MarketplaceId=self.marketplace_id,
            Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(\
            MarketplaceId=self.marketplace_id,
            ASINList=[asin,])
        product = response._result[0].Product


    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(\
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin,])
        product = response._result[0].Product
        self.assertTrue(product.LowestOfferListings)
# ********************** Fill in your credentials. **************************
SELLER_ID	= 'add yours here'
ACCESS_KEY	= 'add yours here'
SECRET_KEY	= 'add yours here'

MARKETPLACE_IDS	= {
    'CA':	'add yours here'
    'MX':	'add yours here'
    'US':	'add yours here'
    }

# Provide your credentials.
conn = MWSConnection(
    Merchant			= SELLER_ID,
    aws_access_key_id		= ACCESS_KEY,
    aws_secret_access_key	= SECRET_KEY,
)

# ********************** Adjust dates.  **************************
# Request report.
# Adjust dates so you get some data but not too much.
# Report types documented here.
# https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
rptReq = conn.request_report(
    ReportType		= '_GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_',
    # Adjust as necessary  StartDate		= '2017-08-01T10:00:00Z',
    # Adjust as necessary  EndDate		= '2017-08-01T11:00:00Z',
    MarketplaceIdList	= [MARKETPLACE_IDS['US']],
)
reqId	= rptReq.RequestReportResult.ReportRequestInfo.ReportRequestId
Exemplo n.º 26
0
#payload = {'amazonorderid':'123123123123'}

url = 'https://api.fieldbook.com/v1/56733a810c342f030073c9d9/orders'
itemUrl = 'https://api.fieldbook.com/v1/56733a810c342f030073c9d9/orderitems'

headers = {'content-type': 'application/json', 'accept': 'application/json'}


accessKey = "accessKey"
merchantID = "merchantID"
marketplaceID = "marketplaceID"
secretKey = "secretKey"


mws = MWSConnection(accessKey, secretKey)
mws.Merchant = merchantID
mws.SellerId = merchantID
mws.MarketplaceId = marketplaceID



while month < 13:
    response = mws.list_orders(CreatedAfter = '2015-12-01T00:00:00Z', MarketplaceId = [marketplaceID])
    #if month>9:
        #response = mws.list_orders(CreatedAfter = '2015-10-01T00:00:00Z', MarketplaceId = [marketplaceID])



    orders = response.ListOrdersResult.Orders.Order
Exemplo n.º 27
0
 def setUp(self):
     self.mws = MWSConnection(Merchant=simple, debug=0)
Exemplo n.º 28
0
Arquivo: test.py Projeto: ketu/flasky
    MarketPlaceID = 'a'
    Merchant = 'a'
    AccessKeyID = 'a'
    SecretKey = 'a'

program_name = sys.argv[0]
MarketPlaceID = sys.argv[1]
Merchant = sys.argv[2]
AccessKeyID = sys.argv[3]
SecretKey = sys.argv[4]

print 'MarketplaceID is ', MarketPlaceID
print 'Merchant is ', Merchant
print 'AccessKey is ', AccessKeyID
print 'Secret key is ', SecretKey
conn = MWSConnection(AccessKeyID,SecretKey)

conn.SellerId = Merchant
conn.Merchant = Merchant
conn.MarketplaceId = MarketPlaceID


myId = '1432456045'

# sample one
conn.get_report(ReportId=myId)

# sample two
conn.get_report(myId)

# sample three