google_price_finder.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:the-price 作者: flochaz 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号