mws package

Submodules

pymazonian.mws module

class pymazonian.mws.Feeds(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

Amazon MWS Feeds API

ACCOUNT_TYPE = 'Merchant'
cancel_feed_submissions(feed_ids=None, feed_types=None, from_date=None, to_date=None)
Parameters:
  • feed_ids (list of str) – A structured list of FeedSubmmissionId values. If you pass in FeedSubmmissionId values in a request, other query conditions are ignored.
  • feed_types (list of str) – A structured list of one or more FeedType values by which to filter the list of feed submissions.
  • from_date – The earliest submission date that you are looking for, in ISO8601 date format.
  • to_date – The latest submission date that you are looking for, in ISO8601 date format.
Returns:

DictWrapper

get_feed_submission_count(feed_types=None, processing_statuses=None, from_date=None, to_date=None)
Parameters:
  • feed_types (list of str) – A structured list of one or more FeedType values by which to filter the list of feed submissions, processing_statuses: A structured list of one or more feed processing statuses by which to filter the list of feed submissions.
  • processing_statuses
  • from_date – The earliest submission date that you are looking for, in ISO8601 date format.
  • to_date – The latest submission date that you are looking for, in ISO8601 date format.
Returns:

DictWrapper

get_feed_submission_list(feed_ids=None, max_count=None, feed_types=None, processing_statuses=None, from_date=None, to_date=None)

Returns a list of all feed submissions submitted in the previous 90 days.

Parameters:
  • feed_ids (list of str) – A structured list of no more than 100 FeedSubmmissionId values. If you pass in FeedSubmmissionId values in a request, other query conditions are ignored.
  • max_count (int) – A non-negative integer that indicates the maximum number of feed submissions to return in the list. If you specify a number greater than 100, the request is rejected.
  • feed_types (list of str) – A structured list of one or more FeedType values by which to filter the list of feed submissions.
  • processing_statuses (list of str) – A structured list of one or more feed processing statuses by which to filter the list of feed submissions.
  • from_date – The earliest submission date that you are looking for, in ISO8601 date format.
  • to_date – The latest submission date that you are looking for, in ISO8601 date format.
Returns:

DictWrapper

get_feed_submission_result(feed_id)

Returns the feed processing report and the Content-MD5 header.

Parameters:feed_id (list of str) – The identifier of the feed submission you are requesting a feed processing report for. You can get the FeedSubmissionId for a feed using the GetFeedSubmissionList operation.
Returns:DictWrapper
get_submission_list_by_next_token(token)
Parameters:token (str) – A string token returned by a previous request to either GetFeedSubmissionList or GetFeedSubmission ListByNextToken where the value of HasNext was true.
Returns:DictWrapper
submit_feed(feed, feed_type, marketplace_ids=None, content_type='text/xml', purge='false')

Uploads a feed ( xml or .tsv ) to the seller’s inventory. Can be used for creating/updating products on Amazon.

Parameters:
  • feed (HTTP-BODY) – The actual content of the feed itself, in XML or flat file format. You must include the FeedContent in the body of the HTTP request
  • feed_type (FeedType) – A FeedType value indicating how the data should be processed. Second line of description should be indented.
  • marketplace_ids (str) – A list of one or more marketplace IDs (of marketplaces you are registered to sell in) that you want the feed to be applied to. The feed will be applied to all the marketplaces you specify.
  • content_type (str) – Your feeds must be in a valid encoding based on your marketplace and file type, and that encoding must be specified as an HTTP Content-Type header. The following table shows the HTTP Content-Type header you should use for flat files and XML files for each marketplace
  • purge (str) – A Boolean value that enables the purge and replace functionality. Set to true to purge and replace the existing data; otherwise false. This value only applies to product-related flat file feed types, which do not have a mechanism for specifying purge and replace in the feed body. Use this parameter only in exceptional cases. Usage is throttled to allow only one purge and replace within a 24-hour period.
Returns:

DictWrapper

class pymazonian.mws.Inventory(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

Amazon MWS Inventory Fulfillment API

NS = '{http://mws.amazonaws.com/FulfillmentInventory/2010-10-01}'
URI = '/FulfillmentInventory/2010-10-01'
VERSION = '2010-10-01'
list_inventory_supply(skus=(), datetime=None, response_group='Basic')

Returns information on available inventory

Parameters:
  • skus
  • datetime
  • response_group
Returns:

DictWrapper

list_inventory_supply_by_next_token(token)
Parameters:token (str) –
Returns:DictWrapper
exception pymazonian.mws.MWSError

Bases: Exception

Main MWS Exception class

response = None
class pymazonian.mws.Reports(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

#Amazon MWS Reports API#

ACCOUNT_TYPE = 'Merchant'
get_report(report_id)

Returns the contents of a report and the Content-MD5 header for the returned report body.

Parameters:report_id (str) – A unique identifier of the report to download, obtained from the GetReportList operation or the GeneratedReportId of a ReportRequest.
Returns:DictWrapper
get_report_count(report_types=(), acknowledged=None, from_date=None, to_date=None)

Returns a count of the reports, created in the previous 90 days, with a status of _DONE_ and that are available for download.

Parameters:
  • report_types (list of str) – A structured list of ReportType enumeration values.
  • acknowledged (bool) – A Boolean value that indicates if an order report has been acknowledged by a prior call to UpdateReportAcknowledgements. Set to true to list order reports that have been acknowledged; set to false to list order reports that have not been acknowledged. This filter is valid only with order reports; it does not work with listing reports.
  • from_date – The earliest date you are looking for, in ISO 8601 date time format.
  • to_date – The most recent date you are looking for, in ISO 8601 date time format.
Returns:

DictWrapper

get_report_list(request_ids=(), max_count=None, types=(), acknowledged=None, from_date=None, to_date=None)

Returns a list of reports that were created in the previous 90 days.

Parameters:
  • request_ids (list of str) – A structured list of ReportRequestId values. If you pass in ReportRequestId values, other query conditions are ignored.
  • max_count (int) – A non-negative integer that represents the maximum number of report requests to return. If you specify a number greater than 100, the request is rejected.
  • types (list of str) – A structured list of ReportType enumeration values.
  • acknowledged (bool) – A Boolean value that indicates if an order report has been acknowledged by a prior call to UpdateReportAcknowledgements. Set to true to list order reports that have been acknowledged; set to false to list order reports that have not been acknowledged. This filter is valid only with order reports; it does not work with listing reports.
  • from_date – The earliest date you are looking for, in ISO 8601 date time format.
  • to_date – The most recent date you are looking for, in ISO 8601 date time format.
Returns:

DictWrapper

get_report_list_by_next_token(token)
Parameters:token (str) – A string token returned in a previous call. Use the NextToken to call the operation again if the return value of HasNext is true.
Returns:DictWrapper
get_report_request_count(report_types=(), processing_statuses=(), from_date=None, to_date=None)
Parameters:
  • report_types
  • processing_statuses
  • from_date
  • to_date
Returns:

DictWrapper

get_report_request_list(request_ids=(), types=(), processing_statuses=(), max_count=None, from_date=None, to_date=None)
Parameters:
  • request_ids
  • types
  • processing_statuses
  • max_count
  • from_date
  • to_date
Returns:

DictWrapper

get_report_request_list_by_next_token(token)
Parameters:token
Returns:DictWrapper
get_report_schedule_count(types=())
Parameters:types
Returns:DictWrapper
get_report_schedule_list(types=())
Parameters:types
Returns:DictWrapper
request_report(report_type, start_date=None, end_date=None, marketplace_ids=())
Parameters:
  • report_type
  • start_date
  • end_date
  • marketplace_ids
Returns:

DictWrapper

class pymazonian.mws.Orders(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

Amazon Orders API

NS = '{https://mws.amazonservices.com/Orders/2013-09-01}'
URI = '/Orders/2013-09-01'
VERSION = '2013-09-01'
get_order(amazon_order_ids)
Parameters:amazon_order_ids
Returns:DictWrapper
list_order_items(amazon_order_id)
Parameters:amazon_order_id
Returns:DictWrapper
list_order_items_by_next_token(token)
Parameters:token
Returns:DictWrapper
list_orders(marketplace_ids, created_after=None, created_before=None, last_updated_after=None, last_updated_before=None, order_status=(), fulfillment_channels=(), payment_methods=(), buyer_email=None, seller_order_id=None, max_results='100')
Parameters:
  • marketplace_ids
  • created_after
  • created_before
  • last_updated_after
  • last_updated_before
  • order_status
  • fulfillment_channels
  • payment_methods
  • buyer_email
  • seller_order_id
  • max_results
Returns:

DictWrapper

list_orders_by_next_token(token)
Parameters:token
Returns:DictWrapper
class pymazonian.mws.Products(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

Amazon MWS Products API

NS = '{http://mws.amazonservices.com/schema/Products/2011-10-01}'
URI = '/Products/2011-10-01'
VERSION = '2011-10-01'
get_competitive_pricing_for_asin(marketplaceid, asins)

Returns the current competitive pricing of a product, based on the ASIN and MarketplaceId that you specify.

Parameters:
  • marketplaceid
  • asins
Returns:

DictWrapper

get_competitive_pricing_for_sku(marketplace_id, skus)

Returns the current competitive pricing of a product, based on the SellerSKU and MarketplaceId that you specify.

Parameters:
  • marketplace_id
  • skus
Returns:

DictWrapper

get_lowest_offer_listings_for_asin(marketplaceid, asins, condition='Any', excludeme='False')
Parameters:
  • marketplaceid
  • asins
  • condition
  • excludeme
Returns:

DictWrapper

get_lowest_offer_listings_for_sku(marketplaceid, skus, condition='Any', excludeme='False')
Parameters:
  • marketplaceid
  • skus
  • condition
  • excludeme
Returns:

DictWrapper

get_lowest_priced_offers_for_asin(marketplaceid, asin, condition='New', excludeme='False')
Parameters:
  • marketplaceid
  • asin
  • condition
  • excludeme
Returns:

DictWrapper

get_lowest_priced_offers_for_sku(marketplaceid, sku, condition='New', excludeme='False')
Parameters:
  • marketplaceid
  • sku
  • condition
  • excludeme
Returns:

DictWrapper

get_matching_product(marketplaceid, asins)

Returns a list of products and their attributes, based on a list of ASIN values that you specify.

Parameters:
  • marketplaceid
  • asins
Returns:

DictWrapper

get_matching_product_for_id(marketplace_id, types, ids)

Returns a list of products and their attributes, based on a list of product identifier values (ASIN, SellerSKU, UPC, EAN, ISBN, GCID and JAN) The identifier type is case sensitive. Added in Fourth Release, API version 2011-10-01

Parameters:
  • marketplace_id
  • types
  • ids
Returns:

DictWrapper

get_my_price_for_asin(marketplaceid, asins, condition=None)
Parameters:
  • marketplaceid
  • asins
  • condition
Returns:

DictWrapper

get_my_price_for_sku(marketplaceid, skus, condition=None)
Parameters:
  • marketplaceid
  • skus
  • condition
Returns:

DictWrapper

get_product_categories_for_asin(marketplaceid, asin)
Parameters:
  • marketplaceid
  • asin
Returns:

DictWrapper

get_product_categories_for_sku(marketplaceid, sku)
Parameters:
  • marketplaceid
  • sku
Returns:

DictWrapper

list_matching_products(marketplaceid, query, contextid=None)

Returns a list of products and their attributes, ordered by relevancy, based on a search query that you specify. Your search query can be a phrase that describes the product or it can be a product identifier such as a UPC, EAN, ISBN, or JAN.

Parameters:
  • marketplaceid
  • query
  • contextid
Returns:

DictWrapper

class pymazonian.mws.Recommendations(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

Amazon MWS Recommendations API

NS = '{https://mws.amazonservices.com/Recommendations/2013-04-01}'
URI = '/Recommendations/2013-04-01'
VERSION = '2013-04-01'
get_last_updated_time_for_recommendations(marketplaceid)

Checks whether there are active recommendations for each category for the given marketplace, and if there are, returns the time when recommendations were last updated for each category.

Parameters:marketplaceid
Returns:DictWrapper
list_recommendations(marketplaceid, recommendationcategory=None)

Returns your active recommendations for a specific category or for all categories for a specific marketplace.

Parameters:
  • marketplaceid
  • recommendationcategory
Returns:

DictWrapper

list_recommendations_by_next_token(token)

Returns the next page of recommendations using the NextToken parameter.

Parameters:token
Returns:DictWrapper
class pymazonian.mws.Sellers(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

Amazon MWS Sellers API

NS = '{http://mws.amazonservices.com/schema/Sellers/2011-07-01}'
URI = '/Sellers/2011-07-01'
VERSION = '2011-07-01'
list_marketplace_participations()

Returns a list of marketplaces a seller can participate in and a list of participations that include seller-specific information in that marketplace. The operation returns only those marketplaces where the seller’s account is in an active state.

Returns:DictWrapper
list_marketplace_participations_by_next_token(token)

Takes a “NextToken” and returns the same information as “list_marketplace_participations”. Based on the “NextToken”.

Parameters:token
Returns:DictWrapper
class pymazonian.mws.InboundShipments(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

URI = '/FulfillmentInboundShipment/2010-10-01'
VERSION = '2010-10-01'
create_inbound_shipment(shipment_id, inbound_shipment_header, inbound_shipment_items)
Parameters:
  • shipment_id
  • inbound_shipment_header
  • inbound_shipment_items
Returns:

DictWrapper

create_inbound_shipment_plan(ship_from_address, inbound_shipment_plan_request_items, ship_to_country_code=None, ship_to_country_ship_to_country_subdivision_code=None, label_prep_preference=None)

The CreateInboundShipmentPlan operation returns one or more inbound shipment plans, which provide the information you need to create one or more inbound shipments for a set of items that you specify. Multiple inbound shipment plans might be required so that items can be optimally placed in Amazon’s fulfillment network—for example, positioning inventory closer to the customer. Alternatively, two inbound shipment plans might be created with the same Amazon fulfillment center destination if the two shipment plans require different processing—for example, items that require labels must be shipped separately from stickerless, commingled inventory.

Parameters:
  • ship_from_address
  • inbound_shipment_plan_request_items
  • ship_to_country_code
  • ship_to_country_ship_to_country_subdivision_code
  • label_prep_preference
Returns:

DictWrapper

inbound_guidance_for_asin(asin_inbound_guidance_list, marketplace_id)

The GetInboundGuidanceForASIN operation lets a seller know if Amazon recommends sending a product to a given marketplace. In some cases, Amazon provides guidance for why a given ASIN is not recommended for shipment to Amazon’s fulfillment network.

Parameters:
  • asin_inbound_guidance_list
  • marketplace_id
Returns:

DictWrapper

inbound_guidance_for_sku(sku_inbound_guidance_list, marketplace_id)

The GetInboundGuidanceForSKU operation lets a seller know if Amazon recommends sending an item to a given marketplace. In some cases, Amazon provides guidance for why a given Seller SKU is not recommended for shipment to Amazon’s fulfillment network.

Parameters:
  • sku_inbound_guidance_list
  • marketplace_id
Returns:

DictWrapper

list_inbound_shipment_items(shipment_id=None, last_updated_after=None, last_updated_before=None)

Returns a list of items contained in an inbound shipment that you specify with a ShipmentId. Alternatively, if you submit the LastUpdatedAfter and LastUpdatedBefore request parameters, the ListInboundShipmentItems operation returns inbound shipment items based on when the items were last updated. Note that if you specify the ShipmentId, then the LastUpdatedAfter and LastUpdatedBefore request parameters are ignored.

Parameters:
  • shipment_id
  • last_updated_after
  • last_updated_before
Returns:

DictWrapper

list_inbound_shipment_items_by_next_token(token)

Takes a “NextToken” and returns the same information as :func “list_inbound_shipment_items”. Based on the “NextToken”.

Parameters:token – A string token returned in the response of your previous request to either ListInboundShipmentItems or ListInboundShipmentItemsByNextToken.
Returns:DictWrapper
list_inbound_shipments(shipment_status_list=None, shipment_id_list=None, last_updated_after=None, last_updated_before=None)
Parameters:
  • shipment_status_list (list of ShipmentStatus) –
  • shipment_id_list (list of ShipmentStatus) –
  • last_updated_after – A date used for selecting inbound shipments that were last updated after (or at) a specified time. The selection includes updates made by Amazon and by the seller.
  • last_updated_before – A date used for selecting inbound shipments that were last updated before (or at) a specified time. The selection includes updates made by Amazon and by the seller.
Returns:

DictWrapper

list_inbound_shipments_by_next_token(token)

Takes a “NextToken” and returns the same information as :func “list_inbound_shipments”. Based on the “NextToken”.

Parameters:token – A string token returned in the response of your previous request to either ListInboundShipments or ListInboundShipmentsByNextToken.
Returns:DictWrapper

pymazonian.offamazonpayments module

class pymazonian.offamazonpayments.OffAmazonPayments(access_key, secret_key, account_id, region='US', domain='', uri='', version='', auth_token='')

Bases: pymazonian.mws.MWS

SANDBOX_URI = '/OffAmazonPayments_Sandbox/2013-01-01/'
URI = '/OffAmazonPayments/2013-01-01/'
VERSION = '2013-01-01'
authorize(order_ref, order_total, auth_id, timeout=60)
cancel_order_reference(order_ref)
capture(auth_id, amount, capture_id, notes='', currency='USD')

Captures funds :param auth_id: the authorization id you want to capture :param amount: the amount you wish to capture :param capture_id: An id that you make up :return: direct response from amazon

close_authorization(auth_id)

Call to close an authorization after the total amount of the authorization has been captured.

close_order_reference(order_ref)
confirm_order_reference(order_ref)
get_authorization_status(auth_id)
get_billing_agreement_details(order_ref, address_consent_token)
get_capture_details(capture_id)
get_order_reference_details(order_ref, address_consent_token='')
get_refund_details(refund_id)

Call to query the status of a particular refund. If you received a Pending status when you called the Refund operation, you can call this operation to get the current status.

refund(capture_id, amount, refund_id, notes='', currency='USD')

Refunds a captured payment :param capture_id: the id of the captured payment :param amount: the amount to refund :param refund_id: a made up refund id for your reference :param notes: :param currency: :return: the direct return value from amazon

set_order_reference_details(order_ref, order_total, store_name, order_id=None, note=None, currency='USD')

pymazonian.utils module

Created on Tue Jun 26 15:42:07 2012

Borrowed from https://github.com/timotheus/ebaysdk-python

@author: pierre

class pymazonian.utils.object_dict(initd=None)

Bases: dict

object view of dict, you can >>> a = object_dict() >>> a.fish = ‘fish’ >>> a[‘fish’] ‘fish’ >>> a[‘water’] = ‘water’ >>> a.water ‘water’ >>> a.test = {‘value’: 1} >>> a.test2 = object_dict({‘name’: ‘test2’, ‘value’: 2}) >>> a.test, a.test2.name, a.test2.value (1, ‘test2’, 2)

getvalue(item, value=None)
class pymazonian.utils.xml2dict

Bases: object

fromstring(s)

parse a string

parse(file)

parse a xml file to a dict

Module contents