Created
April 18, 2018 00:20
-
-
Save elcolumbio/b88ecfaccb0c33d1afcac728d2182edc to your computer and use it in GitHub Desktop.
mws api feeds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from luigipipe.mws import mws | |
def make_feed_row(feed_row_template, product, update_type): | |
return feed_row_template.format(product, '32.00') | |
def create_feed(): | |
feed_header = 'sku\tprice\n' | |
feed_row_template = '{}\t{}' | |
products_to_update = ['geekvape_mini_kit'] | |
feed_row_list = [] | |
for product in products_to_update: | |
feed_row = make_feed_row(feed_row_template, product, update_type=None) | |
feed_row_list.append(feed_row) | |
feed_data = feed_header + '\n'.join(feed_row_list) | |
return feed_data | |
feed_data = create_feed() | |
# unencoded its like: 'sku\tprice\ngeekvape_mini_kit\t32' | |
feed_data.encode('utf8') | |
result = feeds_api.submit_feed(feed_data, '_POST_FLAT_FILE_INVLOADER_DATA_', marketplaceids='A1PA6795UKMFR9') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment