MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / main

Function main

samples/searchforshopping/ranking.py:17–43  ·  view source on GitHub ↗

Get and print a feed of public products in the United States mathing a text search query for 'digital camera' ranked by ascending price. The list method for the resource should be called with the "rankBy" parameter. 5 parameters to rankBy are currently supported by the API. They ar

()

Source from the content-addressed store, hash-verified

15
16
17def main():
18 """Get and print a feed of public products in the United States mathing a
19 text search query for 'digital camera' ranked by ascending price.
20
21 The list method for the resource should be called with the "rankBy"
22 parameter. 5 parameters to rankBy are currently supported by the API. They
23 are:
24
25 "relevancy"
26 "modificationTime:ascending"
27 "modificationTime:descending"
28 "price:ascending"
29 "price:descending"
30
31 These parameters can be combined
32
33 The default ranking is "relevancy" if the rankBy parameter is omitted.
34 """
35 client = build("shopping", SHOPPING_API_VERSION, developerKey=DEVELOPER_KEY)
36 resource = client.products()
37 # The rankBy parameter to the list method causes results to be ranked, in
38 # this case by ascending price.
39 request = resource.list(
40 source="public", country="US", q="digital camera", rankBy="price:ascending"
41 )
42 response = request.execute()
43 pprint.pprint(response)
44
45
46if __name__ == "__main__":

Callers 1

ranking.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…