diff --git a/python/shopping/content/products/insert.py b/python/shopping/content/products/insert.py deleted file mode 100644 index 28dcb71..0000000 --- a/python/shopping/content/products/insert.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2016 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""This example adds a product to a specified account.""" - -from __future__ import print_function -import sys - -from shopping.content import common -from shopping.content.products import sample - - -def main(argv): - # Authenticate and construct service. - service, config, _ = common.init(argv, __doc__) - merchant_id = config['merchantId'] - - offer_id = 'book#%s' % common.get_unique_id() - product = sample.create_product_sample(config, offer_id) - - # Add product. - request = service.products().insert(merchantId=merchant_id, body=product) - - result = request.execute() - print('Product with offerId "%s" was created.' % (result['offerId'])) - - -if __name__ == '__main__': - main(sys.argv) diff --git "a/\316\240\317\215\316\270\317\211\316\275/\317\210\317\216\316\275\316\271\316\261/\317\200\316\265\317\201\316\271\316\265\317\207\317\214\316\274\316\265\316\275\316\277/\317\200\317\201\316\277\317\212\317\214\316\275\317\204\316\261/my-insert.py" "b/\316\240\317\215\316\270\317\211\316\275/\317\210\317\216\316\275\316\271\316\261/\317\200\316\265\317\201\316\271\316\265\317\207\317\214\316\274\316\265\316\275\316\277/\317\200\317\201\316\277\317\212\317\214\316\275\317\204\316\261/my-insert.py" new file mode 100644 index 0000000..3d5fe8f --- /dev/null +++ "b/\316\240\317\215\316\270\317\211\316\275/\317\210\317\216\316\275\316\271\316\261/\317\200\316\265\317\201\316\271\316\265\317\207\317\214\316\274\316\265\316\275\316\277/\317\200\317\201\316\277\317\212\317\214\316\275\317\204\316\261/my-insert.py" @@ -0,0 +1,49 @@ +from __future__ import print_function +import sys + +# The common module provides setup functionality used by the samples, +# such as authentication and unique id generation. +from shopping.content import common +offer_id = 'book#%s' % common.get_unique_id() +product = { + 'offerId': + offer_id, + 'title': + 'A Tale of Two Cities', + 'description': + 'A classic novel about the French Revolution', + 'link': + 'http://my-book-shop.com/tale-of-two-cities.html', + 'imageLink': + 'http://my-book-shop.com/tale-of-two-cities.jpg', + 'contentLanguage': + 'en', + 'targetCountry': + 'US', + 'channel': + 'online', + 'availability': + 'in stock', + 'condition': + 'new', + 'googleProductCategory': + 'Media > Books', + 'gtin': + '9780007350896', + 'price': { + 'value': '2.50', + 'currency': 'USD' + }, + 'shipping': [{ + 'country': 'US', + 'service': 'Standard shipping', + 'price': { + 'value': '0.99', + 'currency': 'USD' + } + }], + 'shippingWeight': { + 'value': '200', + 'unit': 'grams' + } +}