File: basic.py

package info (click to toggle)
python-googleapi 1.5.0-2~bpo8%2B1
  • links: PTS
  • area: main
  • in suites: jessie-backports
  • size: 28,336 kB
  • sloc: python: 6,808; makefile: 64; sh: 53; xml: 5
file content (32 lines) | stat: -rw-r--r-- 756 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 Google Inc. All Rights Reserved.

"""Basic query against the public shopping search API"""

import pprint

from googleapiclient.discovery import build


SHOPPING_API_VERSION = 'v1'
DEVELOPER_KEY = 'AIzaSyACZJW4JwcWwz5taR2gjIMNQrtgDLfILPc'


def main():
  """Get and print a feed of all public products available in the
  United States.

  Note: The source and country arguments are required to pass to the list
  method.
  """
  client = build('shopping', SHOPPING_API_VERSION, developerKey=DEVELOPER_KEY)
  resource = client.products()
  request = resource.list(source='public', country='US')
  response = request.execute()
  pprint.pprint(response)


if __name__ == '__main__':
    main()