Returning a boolean or a string seems a bit strange. Since add_friend can return multiple states (not just True/False) it might be better to return the JSON response (r.json()) instead.