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


Python Client.search_by_bounding_box方法代码示例

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


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

示例1: getresponse

# 需要导入模块: from yelp.client import Client [as 别名]
# 或者: from yelp.client.Client import search_by_bounding_box [as 别名]
def getresponse(term,lat,lon):
	#term, location coords
	R = 6371
	radius = 2
	filename = 'config_secret.json'
	with io.open('/Users/thiyagesh/Desktop/yelp/drf-demo/drf_demo/model_less/config_secret.json') as cred:
    		creds = json.load(cred)
    		auth = Oauth1Authenticator(**creds)
    		client = Client(auth)
	params = {
    		'term': term,
    		'lang': 'fr'
		}
	result = []
	lat = float(lat)
	lon = float(lon) 
	x1 = lon - math.degrees((radius*math.cos(math.radians(lat)))/R)
	x2 = lon + math.degrees((radius*math.cos(math.radians(lat)))/R)
	y1 = lat + math.degrees(radius/R)
	y2 = lat - math.degrees(radius/R)
	print "Original:",lat,lon
	print "Next:",lat-0.001,lon+0.001
	response = client.search_by_bounding_box(
    		lat+0.01,
		lon-0.01,
		lat-0.01,
		lon+0.01,
    		**params
		)
	#response = client.search_by_coordinates(lat, long, **params)
	for i in response.businesses: 
		result.append(i.name) 
	if len(result) != 0:
		return result
	else:
		return None	 
开发者ID:Thiyageshv,项目名称:PizzaReminder,代码行数:38,代码来源:auth.py


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