def venue_search(search_terms): venue_client = VenueApiClient(KEY) name = search_terms.get("search_query",'') city = search_terms.get("city",'') state = search_terms.get("state",'') response = venue_client.search(name=name,locality = city, region=state)["objects"] venues =[] if response: venues = [Venue(entry,"search") for entry in response] venues = Search.filter_bad_results(venues,city, state) return venues
global KEY KEY = '2d36afa81b05f641ec3382d9992b8cec3d64a4e4' s_type = sys.argv[1].strip() if s_type =="v" or s_type == 'm': print "in if" client = VenueApiClient(KEY) elif s_type =="d": client = MenuItemApiClient(KEY) raw_in= sys.argv[2].strip() search_terms = raw_in.split(',') resp = client.search(name =search_terms[0],locality=search_terms[1],region=search_terms[2]) if s_type == "v" or s_type =="d": print json.dumps(resp,indent=4, sort_keys=True) else: dets = client.get_details(resp["objects"][0]["id"]) print json.dumps(dets,indent=4, sort_keys=True)
def make_obj_by_search(self): venue_client = VenueApiClient(KEY) venue_response = venue_client.search(name="Taqueria Belly",locality='eugene',region='OR')["objects"][0] v = Venue(venue_response,"search") return v