def get_film_value(film_name): value = GraphQuery.getFilmValue(GraphQuery(), InitGraph.filmNodes, film_name) if value is None: print("Invalid Film!") else: print('Gross Value: {0:s}'.format(value))
def get(self, film_name): if len(film_name) <= 0: abort(400) value = GraphQuery.getFilmValue(GraphQuery(), InitGraph.filmNodes, film_name) starrings = GraphQuery.getActorsInFilm(GraphQuery(), InitGraph.filmNameDict, film_name) data = { 'film_name': film_name, 'film_value': value, 'film_starrings': starrings } return make_response(jsonify({'films': marshal(data, film_field)}), 200)
def put(self, film_name): if len(film_name) <= 0: abort(400) value = GraphQuery.getFilmValue(GraphQuery(), InitGraph.filmNodes, film_name) starrings = GraphQuery.getActorsInFilm(GraphQuery(), InitGraph.filmNameDict, film_name) data = { 'film_name': film_name, 'film_value': value, 'film_starrings': starrings } args = request.get_json() if args is not None: for k, v in args.items(): if v is not None: data[k] = v return {'films': data}