Skip to content

Instantly share code, notes, and snippets.

@ashaegupta
Created March 10, 2012 04:03
Show Gist options
  • Save ashaegupta/2010034 to your computer and use it in GitHub Desktop.
Save ashaegupta/2010034 to your computer and use it in GitHub Desktop.
def fs_parse_response(response, yelp_results):
results = {}
results["body"] = []
results["has_ordered_results"] = True
try:
r = response["response"]
groups = r["groups"]
groups = groups[0]
items = groups["items"]
for item in items:
venue = item["venue"]
phone = venue["contact"]["phone"]
print "phone"
if yelp_results["body"].has_key(phone):
place = {}
place[phone] = yelp_results["body"][phone]
tips = item["tips"]
tips = tips[0]
tip = tips["text"]
print tip
place[phone]["tips"] = tip
print "made it to adding tip"
results["body"].append(entry)
print "made it to results"
except:
return APIResponse.FS_API_INVALID_RESULTS
return results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment