Created
March 10, 2012 04:03
-
-
Save ashaegupta/2010034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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