MCPcopy Create free account
hub / github.com/googleapis/google-api-python-client / main

Function main

samples/searchforshopping/restricting.py:18–41  ·  view source on GitHub ↗

Get and print a feed of all public products matching the search query "digital camera", that are created by "Canon" available in the United States. The "restrictBy" parameter controls which types of results are returned. Multiple values for a single restrictBy can be separated by t

()

Source from the content-addressed store, hash-verified

16
17
18def main():
19 """Get and print a feed of all public products matching the search query
20 "digital camera", that are created by "Canon" available in the
21 United States.
22
23 The "restrictBy" parameter controls which types of results are returned.
24
25 Multiple values for a single restrictBy can be separated by the "|" operator,
26 so to look for all products created by Canon, Sony, or Apple:
27
28 restrictBy = 'brand:canon|sony|apple'
29
30 Multiple restricting parameters should be separated by a comma, so for
31 products created by Sony with the word "32GB" in the title:
32
33 restrictBy = 'brand:sony,title:32GB'
34 """
35 client = build("shopping", SHOPPING_API_VERSION, developerKey=DEVELOPER_KEY)
36 resource = client.products()
37 request = resource.list(
38 source="public", country="US", restrictBy="brand:canon", q="Digital Camera"
39 )
40 response = request.execute()
41 pprint.pprint(response)
42
43
44if __name__ == "__main__":

Callers 1

restricting.pyFile · 0.70

Calls 2

buildFunction · 0.90
executeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…