当前位置: 首页>>代码示例>>Python>>正文


Python Client.get_business方法代码示例

本文整理汇总了Python中yelp.client.Client.get_business方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get_business方法的具体用法?Python Client.get_business怎么用?Python Client.get_business使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yelp.client.Client的用法示例。


在下文中一共展示了Client.get_business方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: YelpClient

# 需要导入模块: from yelp.client import Client [as 别名]
# 或者: from yelp.client.Client import get_business [as 别名]
class YelpClient(object):

    def __init__(self):
        auth = Oauth1Authenticator(
                consumer_key= 'NqKErS1dFKKwfxlc5KpB0Q',
                consumer_secret= 'BzO_xc7Jge-B5YeysLuLi-WkiHE',
                token= '72CDWmpOaC8LEVgjY1bZVQgyX4v3v8fx',
                token_secret='yLfQC1-Vr_B5mpuqKtidnK_gnbo'
                )
        self.client = Client(auth)

    def search(self,params):
        return self.client.get_business(params)
开发者ID:daoanhnhat1995,项目名称:CS-4392-Keep-It-Fresh,代码行数:15,代码来源:yelp_client.py

示例2: get_total_ratings

# 需要导入模块: from yelp.client import Client [as 别名]
# 或者: from yelp.client.Client import get_business [as 别名]
def get_total_ratings(x):
    # authenticate the api
    auth = Oauth1Authenticator(
        consumer_key='d8eoj4KNoPqOqE_RN9871Q',
        consumer_secret='pGVDNEGSaH8Kv-WZ8ba5v02IjCo',
        token='S-SfyVte5G0nCkTmbydWRtxlheNXCEnG',
        token_secret='Y_UViE9LthLQqW7_ht8U8V_F6aE'
    )
    client = Client(auth)

    # return the total number of ratings for a restaurant
    total_ratings = client.get_business(x)
    total_ratings = total_ratings.business.review_count
    return total_ratings
开发者ID:wsharif,项目名称:yelp_hackathon_2016,代码行数:16,代码来源:restaurant_stats.py

示例3: YelpService

# 需要导入模块: from yelp.client import Client [as 别名]
# 或者: from yelp.client.Client import get_business [as 别名]
class YelpService(object):

    def __init__(self):
        auth = Oauth1Authenticator(
            consumer_key="uz2Sv5gO6dwlnjRv3BqzwA",
            consumer_secret="VhgG3IucBO_eTheOlWzrVuuVjbU",
            token="bN1HD9FSDGqUWjzxbIkho_N1muVe0xcA",
            token_secret="hEdALK5D2gCI9-H3GwGKAw1jEYo"
        )

        self.client = Client(auth)

        self._business_cache = {}

    def get_location(self, yelp_id):
        """
        Get the location of a yelp business
        """
        business = self._get_business(yelp_id)
        return business.location.coordinate

    def get_name(self, yelp_id):
        """
        Get the name of a location
        """
        business = self._get_business(yelp_id)
        return business.name

    def get_url(self, yelp_id):
        """
        Get the url to the yelp side of a business
        """
        business = self._get_business(yelp_id)
        return business.url

    def _get_business(self, yelp_id):
        if yelp_id in self._business_cache:
            return self._business_cache[yelp_id]
        else:
            response = self.client.get_business(yelp_id)
            self._business_cache[yelp_id] = response.business
            return response.business

    def search(self, query, location):
        response = self.client.search(location=location, term=query)
        return response.businesses
开发者ID:fechu,项目名称:COS448,代码行数:48,代码来源:services.py

示例4: print

# 需要导入模块: from yelp.client import Client [as 别名]
# 或者: from yelp.client.Client import get_business [as 别名]
    'lang': 'en'
}

response = client.search('Montreal', **params)

#get their ID

####response.businesses[0].id

print(response.businesses[0].id)

str1 = str(response.businesses[0].id)

#get reviews for this business-id

params_b = {
         'lang' : 'en'
    }

response_b = client.get_business(str1, **params)

#print(response_b.reviews)

'''   
response = client.get_business('yelp-san-francisco', **params)

print(response)
print(response.business.name)
print(response.business.categories)
'''
开发者ID:lenmorld,项目名称:Yackathon_keyword_map,代码行数:32,代码来源:business_search.py


注:本文中的yelp.client.Client.get_business方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。