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
()
| 15 | |
| 16 | |
| 17 | def 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 | |
| 46 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…