<s> from flask import Flask , make_response , jsonify <EOL> from flask . ext . restful import Api <EOL> from flask . ext . cors import CORS <EOL> from reststub . resources import ItemListAPI <EOL> from reststub . resources import ItemAPI <EOL> from reststub . globals import auth <EOL> rest_stub_app = Flask ( __name__ ) <EOL> rest_stub_app . debug = True <EOL> api = Api ( rest_stub_app ) <EOL> api . add_resource ( ItemListAPI , '<STR_LIT>' , endpoint = '<STR_LIT>' ) <EOL> api . add_resource ( ItemAPI , '<STR_LIT>' , endpoint = '<STR_LIT>' ) <EOL> CORS ( rest_stub_app ) <EOL> @ rest_stub_app . errorhandler ( <NUM_LIT> ) <EOL> def not_found ( error ) : <EOL> return make_response ( jsonify ( { '<STR_LIT:error>' : '<STR_LIT>' } ) , <NUM_LIT> ) <EOL> @ auth . get_password <EOL> def get_password ( username ) : <EOL> if username == "<STR_LIT>" : <EOL> return "<STR_LIT>" <EOL> return None <EOL> @ auth . error_handler <EOL> def unauthorized ( ) : <EOL> return make_response ( jsonify ( { '<STR_LIT:message>' : '<STR_LIT>' } ) , <NUM_LIT> ) <EOL> def run_server ( ) : <EOL> rest_stub_app . run ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> run_server ( ) </s>
