Example #1
0
def get_nearby_result(query, lat, lon, result_types):
	location_str = str(lat) + "," + str(lon)
	query_result = google_places.nearby_search(
		location=location_str, keyword=query,
		radius=20000, types=result_types)

	places = []
	length = min(query_result.places, 2)

	for g_place in query_result.places[:length]:
		place = Place(g_place.geo_location, g_place.name, g_place.place_id)
		g_place.get_details()
		place.set_detail(g_place.website)
		for photo in g_place.photos:
			photo.get(maxheight=500, maxwidth=500)
			place.add_image(photo.url)
		places.append(place)
	return places