|
1 | | -python-amazon-mws |
2 | | -================= |
| 1 | +# ** DISCLAIMER ** |
| 2 | +This API is in constant development. Do not rely on it too much until its in stable release. |
| 3 | +All except for the last two APIs ( InboundShipment and OutboundShipment ) are complete. |
| 4 | +Help towards completing this last two APIs would be greatly appreciated. |
| 5 | +I will mark this as stable 1.0 once all tests have been completed. |
3 | 6 |
|
4 | | -A simple python API for Amazon MWS |
| 7 | + |
| 8 | + |
| 9 | +# Python Amazon MWS |
| 10 | + |
| 11 | +Python Amazon MWS is a python interface for the Amazon MWS API. |
| 12 | +I wrote it to help me upload my products to amazon. However, seeing its potential i decided |
| 13 | +to expand it in order for it to cover most ( if not all ) operations in the Amazon MWS. |
| 14 | + |
| 15 | +This is still an ongoing project. If you would like to contribute, see below :). |
| 16 | + |
| 17 | + |
| 18 | +Its based on the [amazon-mws-python](http://code.google.com/p/amazon-mws-python). |
| 19 | + |
| 20 | +# API usage |
| 21 | + |
| 22 | +Make sure you check out the Amazon MWS documentation at https://developer.amazonservices.com/ |
| 23 | + |
| 24 | +Here's an exmaple of how to use python-amazon-mws to upload your products to amazon. |
| 25 | + |
| 26 | + |
| 27 | +```python |
| 28 | +from mws import mws |
| 29 | + |
| 30 | +# You can get all these credentials when you sign up for Amazon MWS |
| 31 | + |
| 32 | +MWS_ACCESS_KEY = 'your key' |
| 33 | +MWS_SECRET_KEY = 'your secret' |
| 34 | +MERCHANT_ID = 'your merchantid' |
| 35 | + |
| 36 | +# Amazon supports different file formats for uploading products |
| 37 | +# here i use a simple tsv file. |
| 38 | + |
| 39 | +file_name = "templates/amazon-upload.tsv" |
| 40 | + |
| 41 | +with open(file_name, "r+") as f: |
| 42 | + data = f.read() |
| 43 | + f.close() |
| 44 | + amazon = mws.Feeds(MWS_ACCESS_KEY, MWS_SECRET_KEY, MERCHANT_ID) |
| 45 | + response = amazon.submit_feed(data, feed_type="_POST_FLAT_FILE_LISTINGS_DATA_", |
| 46 | + content_type="text/tab-separated-values;charset=iso-8859-1") |
| 47 | + |
| 48 | +# In shell... |
| 49 | + |
| 50 | +print response |
| 51 | +<Element '{http://mws.amazonaws.com/doc/2009-01-01/}SubmitFeedResponse' at 0x8edaa4c> |
| 52 | + |
| 53 | +``` |
| 54 | +For more information, check out the [Products API Documentation](https://developer.amazonservices.com/gp/mws/api.html/182-2079318-8524647?ie=UTF8§ion=products&group=products&version=latest). |
| 55 | + |
| 56 | +Here's another example in which i use python-amazon-mws to query amazon for a product using the product's UPC |
| 57 | + |
| 58 | +```python |
| 59 | +from mws import mws |
| 60 | + |
| 61 | +MWS_ACCESS_KEY = 'your key' |
| 62 | +MWS_SECRET_KEY = 'your secret' |
| 63 | +MERCHANT_ID = 'your merchantid' |
| 64 | +MARKETPLACE_ID = 'your marketplaceid' |
| 65 | +UPC = "886039397430" |
| 66 | + |
| 67 | +amazon = mws.Products(MWS_ACCESS_KEY, MWS_SECRET_KEY, MERCHANT_ID) |
| 68 | +response = amazon.list_matching_products(UPC, MARKETPLACE_ID) |
| 69 | + |
| 70 | +# In shell... |
| 71 | + |
| 72 | +print response |
| 73 | +<Element '{http://mws.amazonservices.com/schema/Products/2011-10-01}ListMatchingProductsResponse' at 0xa1b188c> |
| 74 | + |
| 75 | +``` |
| 76 | + |
| 77 | +# To-Do |
| 78 | + |
| 79 | +* Update README |
| 80 | +* Create tests |
| 81 | +* Finish InboundShipments & OutboundShipments APIs |
| 82 | +* Build Docs |
| 83 | + |
| 84 | +# Contribute |
| 85 | + |
| 86 | +If you like the project, please, contact me at commonzenpython@gmail.com (gtalk and email) and help me improve it. |
0 commit comments