Skip to content

kukhmaz/python-amazon-mws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

** DISCLAIMER **

This API is in constant development. Do not rely on it too much until its in stable release. All except for the last two APIs ( InboundShipment and OutboundShipment ) are complete. Help towards completing this last two APIs would be greatly appreciated. I will mark this as stable 1.0 once all tests have been completed.

Python Amazon MWS

Python Amazon MWS is a python interface for the Amazon MWS API. I wrote it to help me upload my products to amazon. However, seeing its potential i decided to expand it in order for it to cover most ( if not all ) operations in the Amazon MWS.

This is still an ongoing project. If you would like to contribute, see below :).

Its based on the amazon-mws-python.

API usage

Make sure you check out the Amazon MWS documentation at https://developer.amazonservices.com/

Here's an exmaple of how to use python-amazon-mws to upload your products to amazon.

from mws import mws

# You can get all these credentials when you sign up for Amazon MWS

MWS_ACCESS_KEY = 'your key'
MWS_SECRET_KEY = 'your secret'
MERCHANT_ID = 'your merchantid'

# Amazon supports different file formats for uploading products
# here i use a simple tsv file.

file_name = "templates/amazon-upload.tsv"

with open(file_name, "r+") as f:
    data = f.read()
    f.close()
    amazon = mws.Feeds(MWS_ACCESS_KEY, MWS_SECRET_KEY, MERCHANT_ID)
    response = amazon.submit_feed(data, feed_type="_POST_FLAT_FILE_LISTINGS_DATA_", 
                                    content_type="text/tab-separated-values;charset=iso-8859-1")

# In shell...

print response
<Element '{http://mws.amazonaws.com/doc/2009-01-01/}SubmitFeedResponse' at 0x8edaa4c>

For more information, check out the Products API Documentation.

Here's another example in which i use python-amazon-mws to query amazon for a product using the product's UPC

from mws import mws

MWS_ACCESS_KEY = 'your key'
MWS_SECRET_KEY = 'your secret'
MERCHANT_ID = 'your merchantid'
MARKETPLACE_ID = 'your marketplaceid'
UPC = "886039397430"

amazon = mws.Products(MWS_ACCESS_KEY, MWS_SECRET_KEY, MERCHANT_ID)
response = amazon.list_matching_products(UPC, MARKETPLACE_ID)

# In shell...

print response
<Element '{http://mws.amazonservices.com/schema/Products/2011-10-01}ListMatchingProductsResponse' at 0xa1b188c>

Contribute

If you like the project, plz, contact me at [email protected] (gtalk and email) and help me improve it.

About

A simple python API for Amazon MWS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published