<s> from flask import jsonify <EOL> from flask . ext . apiblueprint import APIBlueprint <EOL> from sample_api import User , Media <EOL> api_v1 = APIBlueprint ( '<STR_LIT>' , __name__ , subdomain = '<STR_LIT>' , url_prefix = '<STR_LIT>' ) <EOL> @ api_v1 . route ( '<STR_LIT>' ) <EOL> def username ( user_id ) : <EOL> username = User . query . get ( user_id ) . username <EOL> return jsonify ( username = username ) <EOL> @ api_v1 . route ( '<STR_LIT>' ) <EOL> def users_list ( ) : <EOL> users = User . query . all ( ) <EOL> usernames = [ { '<STR_LIT:username>' : user . username } for user in users ] <EOL> return jsonify ( data = usernames ) <EOL> @ api_v1 . route ( '<STR_LIT>' ) <EOL> def media_info ( media_id ) : <EOL> kind = Media . query . get ( media_id ) . kind <EOL> return jsonify ( data = dict ( kind = kind ) ) </s>
