client = ContentForShoppingClient(account_id)

# Perform programmatic login
client.client_login(email, getpass.getpass('Google Password? '),
    'Shopping API for Content sample', 'structuredcontent')

products = []

for color in ['red', 'green', 'white', 'black', 'purple', 'brown', 'yellow',
              'orange', 'magenta']:
  # Generate a product entry
  product_entry = build_entry(
    product_id='ipod%s' % color,
    target_country = 'US',
    content_language = 'EN',
    title='iPod Nano 8GB, %s' % color,
    content='A nice small mp3 player, in %s' % color,
    price='149',
    price_unit='USD',
    shipping_price = '5',
    shipping_price_unit = 'USD',
    tax_rate='17.5',
    condition = 'new',
    link = 'http://pseudoscience.co.uk/google4e823e35f032f011.html',
    color = color,
  )
  products.append(product_entry)

# Post it to the service
client.insert_products(products)
# Perform programmatic login
client.client_login(email, getpass.getpass('Google Password? '),
                    'Shopping API for Content sample', 'structuredcontent')

products = []

for color in [
        'red', 'green', 'white', 'black', 'purple', 'brown', 'yellow',
        'orange', 'magenta'
]:
    # Generate a product entry
    product_entry = build_entry(
        product_id='ipod%s' % color,
        target_country='US',
        content_language='EN',
        title='iPod Nano 8GB, %s' % color,
        content='A nice small mp3 player, in %s' % color,
        price='149',
        price_unit='USD',
        shipping_price='5',
        shipping_price_unit='USD',
        tax_rate='17.5',
        condition='new',
        link='http://pseudoscience.co.uk/google4e823e35f032f011.html',
        color=color,
    )
    products.append(product_entry)

# Post it to the service
client.insert_products(products)
示例#3
0
# Gather merchant information
account_id = raw_input('Merchant Account ID? ').strip()
email = raw_input('Google Email Address? ').strip()

# Create a client
client = ContentForShoppingClient(account_id)

# Perform programmatic login
client.client_login(email, getpass.getpass('Google Password? '),
    'Shopping API for Content sample', 'structuredcontent')

# Generate a product entry
product_entry = build_entry(
  product_id='ipod2',
  target_country = 'US',
  content_language = 'EN',
  title='iPod Nano 8GB',
  content='A nice small mp3 player',
  price='149',
  price_unit='USD',
  shipping_price = '5',
  shipping_price_unit = 'USD',
  tax_rate='17.5',
  condition = 'new',
  link = 'http://pseudoscience.co.uk/google4e823e35f032f011.html',
  identifier_exists='hello'
)

# Post it to the service
client.insert_product(product_entry)