Пример #1
0
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))
Пример #2
0
 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)
Пример #3
0
 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}