diff --git a/api.py b/api.py index c859443..2f03d42 100644 --- a/api.py +++ b/api.py @@ -1,11 +1,13 @@ from fastapi import FastAPI from movies import Movies +from recommendation_system import Recommendation movies_obj = Movies() +recomendation_obj = Recommendation() app = FastAPI() -@app.get('/movie/month/{month}') +@app.get('/cantidad_filmaciones_mes/{month}') def get_count_movies_month(month: str): """Get the amount of movies released in the requested month. @@ -18,7 +20,7 @@ def get_count_movies_month(month: str): return movies_obj.get_count_movies_month(month=month) -@app.get('/movie/day/{day}') +@app.get('/cantidad_filmaciones_dia/{day}') def get_count_movies_day(day: str): """Get the amount of movies released in the requested day. @@ -31,7 +33,7 @@ def get_count_movies_day(day: str): return movies_obj.get_count_movies_day(day=day) -@app.get('/movie/score/{title}') +@app.get('/score_titulo/{title}') def get_score_title(title: str): """Get the released year and the score of the requested title. @@ -44,7 +46,7 @@ def get_score_title(title: str): return movies_obj.get_score_title(title=title) -@app.get('/movie/vote/{title}') +@app.get('/votos_titulo/{title}') def get_votes_title(title: str): """Get the released year, vote count and vote average of the requested title. @@ -57,7 +59,7 @@ def get_votes_title(title: str): return movies_obj.get_votes_title(title=title) -@app.get('/movie/actor/{actor}') +@app.get('/get_actor/{actor}') def get_actor(actor: str): """Get the actor movies, themaximun return ans the average return. @@ -70,7 +72,7 @@ def get_actor(actor: str): return movies_obj.get_actor(actor=actor) -@app.get('/movie/director/{director}') +@app.get('/get_director/{director}') def get_director(director: str): """Get all the movies, released year, return, revenue and budget of the requested director. @@ -81,3 +83,16 @@ def get_director(director: str): dict: Message with the information requested. """ return movies_obj.get_director(director=director) + + +@app.get('/recomendacion/{title}') +def get_recomendation(title: str): + """Get the recomendation accordint to requested title. + + Args: + title (str, optional): Movie to be searched. Defaults to ''. + + Returns: + dict: Message with the information requested. + """ + return recomendation_obj.recommendation(title=title)