def find(self, item):
try:
log.info('search for {item} through {class_name}'.format(item=item, class_name=__name__))
service = build("customsearch", "v1",
developerKey=google_developer_key)
#https://developers.google.com/custom-search/json-api/v1/reference/cse/list#response
response = service.cse().list(
q='how much is the ' + item,
cx=google_custom_search_engine_key,
).execute()
#log.debug('RESPONSE = {response}'.format(pprint.pprint(response)))
original_description, price, currency = parse_response(response)
return original_description, price, currency
#TODO identify proper Exception to expect
except Exception as e:
log.error(e)
评论列表
文章目录