From 6210a5c8472dc58baad7b766ffcac0bd633b1220 Mon Sep 17 00:00:00 2001 From: zanthl2 <83887309+zanthl2@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:08:17 +0300 Subject: [PATCH 1/3] Update and rename insert.py to my-insert.py --- python/shopping/content/products/insert.py | 41 ------------ python/shopping/content/products/my-insert.py | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 41 deletions(-) delete mode 100644 python/shopping/content/products/insert.py create mode 100644 python/shopping/content/products/my-insert.py 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/python/shopping/content/products/my-insert.py b/python/shopping/content/products/my-insert.py new file mode 100644 index 0000000..50a7c7b --- /dev/null +++ b/python/shopping/content/products/my-insert.py @@ -0,0 +1,66 @@ +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' + } +}def main(argv): + # Construct the service object to interact with the Content API. + service, config, _ = common.init(argv, __doc__) + + # Get the merchant ID from merchant-info.json. + merchant_id = config['merchantId'] + + # Create the request with the merchant ID and product object. + request = service.products().insert(merchantId=merchant_id, body=product) + + # Execute the request and print the result. + result = request.execute() + print('Product with offerId "%s" was created.' % (result['offerId'])) + +# Allow the function to be called with arguments passed from the command line. +if __name__ == '__main__': + main(sys.argv) + From 81ce975299c390d7ecba26e6920c6f56dee32570 Mon Sep 17 00:00:00 2001 From: zanthl2 <83887309+zanthl2@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:31:30 +0300 Subject: [PATCH 2/3] Update my-insert.py --- python/shopping/content/products/my-insert.py | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/python/shopping/content/products/my-insert.py b/python/shopping/content/products/my-insert.py index 50a7c7b..ba93bd8 100644 --- a/python/shopping/content/products/my-insert.py +++ b/python/shopping/content/products/my-insert.py @@ -4,63 +4,3 @@ # 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' - } -}def main(argv): - # Construct the service object to interact with the Content API. - service, config, _ = common.init(argv, __doc__) - - # Get the merchant ID from merchant-info.json. - merchant_id = config['merchantId'] - - # Create the request with the merchant ID and product object. - request = service.products().insert(merchantId=merchant_id, body=product) - - # Execute the request and print the result. - result = request.execute() - print('Product with offerId "%s" was created.' % (result['offerId'])) - -# Allow the function to be called with arguments passed from the command line. -if __name__ == '__main__': - main(sys.argv) - From 8f0e5db81acd13c22ee131ca2cd7bb563fd28921 Mon Sep 17 00:00:00 2001 From: zanthl2 <83887309+zanthl2@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:32:44 +0300 Subject: [PATCH 3/3] =?UTF-8?q?Update=20and=20rename=20python/shopping/con?= =?UTF-8?q?tent/products/my-insert.py=20to=20=CE=A0=CF=8D=CE=B8=CF=89?= =?UTF-8?q?=CE=BD/=CF=88=CF=8E=CE=BD=CE=B9=CE=B1/=CF=80=CE=B5=CF=81=CE=B9?= =?UTF-8?q?=CE=B5=CF=87=CF=8C=CE=BC=CE=B5=CE=BD=CE=BF/=CF=80=CF=81=CE=BF?= =?UTF-8?q?=CF=8A=CF=8C=CE=BD=CF=84=CE=B1/my-insert.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/shopping/content/products/my-insert.py | 6 --- .../my-insert.py" | 49 +++++++++++++++++++ 2 files changed, 49 insertions(+), 6 deletions(-) delete mode 100644 python/shopping/content/products/my-insert.py create mode 100644 "\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" diff --git a/python/shopping/content/products/my-insert.py b/python/shopping/content/products/my-insert.py deleted file mode 100644 index ba93bd8..0000000 --- a/python/shopping/content/products/my-insert.py +++ /dev/null @@ -1,6 +0,0 @@ -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 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' + } +}