<s> from services import root_dir , nice_json <EOL> from flask import Flask <EOL> from werkzeug . exceptions import NotFound <EOL> import json <EOL> app = Flask ( __name__ ) <EOL> with open ( "<STR_LIT>" . format ( root_dir ( ) ) , "<STR_LIT:r>" ) as f : <EOL> movies = json . load ( f ) <EOL> @ app . route ( "<STR_LIT:/>" , methods = [ '<STR_LIT:GET>' ] ) <EOL> def hello ( ) : <EOL> return nice_json ( { <EOL> "<STR_LIT>" : "<STR_LIT:/>" , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> } ) <EOL> @ app . route ( "<STR_LIT>" , methods = [ '<STR_LIT:GET>' ] ) <EOL> def movie_info ( movieid ) : <EOL> if movieid not in movies : <EOL> raise NotFound <EOL> result = movies [ movieid ] <EOL> result [ "<STR_LIT>" ] = "<STR_LIT>" . format ( movieid ) <EOL> return nice_json ( result ) <EOL> @ app . route ( "<STR_LIT>" , methods = [ '<STR_LIT:GET>' ] ) <EOL> def movie_record ( ) : <EOL> return nice_json ( movies ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> app . run ( port = <NUM_LIT> , debug = True ) </s>
