Last active
April 11, 2021 08:58
-
-
Save hamletbatista/186b2efa4bd0c5a0ff72c58de3c81406 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
product_id="online:en:US:XX-XXXXX-XXXX-XX" | |
merchant_id = XXXXXXX | |
product = service.products().get( | |
merchantId=merchant_id, productId=product_id).execute() | |
#partial example product result | |
"""{'adwordsRedirect': 'https://www.website.com/product/product_url?code=XXX', | |
'ageGroup': 'adult', | |
'availability': 'in stock', | |
'brand': 'XXXXX', | |
'channel': 'online', | |
'color': 'Black', | |
'condition': 'new', | |
'contentLanguage': 'en', | |
... | |
}""" | |
print(product["title"]) # output -> 'XXX Custom XXX XXXXX XXX XXX XXXXX XXX XXX XXXX' | |
#now let's prepare the change | |
product["title"] = 'XXX Personalized XXX XXXXX XXX XXX XXXXX XXX XXX XXXX' | |
#this line performs the update | |
request = service.products().insert(merchantId=merchant_id, body=product) | |
result = request.execute() | |
print(result["title"]) # output -> XXX Personalized XXX XXXXX XXX XXX XXXXX XXX XXX XXXX' | |
#the product was updated in Google Shopping programatically | |
#you can use the API explorer to confirm | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment