-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.py
98 lines (69 loc) · 2.62 KB
/
api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from fastapi import FastAPI
from movies import Movies
from recommendation_system import Recommendation
movies_obj = Movies()
recomendation_obj = Recommendation()
app = FastAPI()
@app.get('/cantidad_filmaciones_mes/{month}')
async def get_count_movies_month(month: str):
"""Get the amount of movies released in the requested month.
Args:
month (str, optional): Released month. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return movies_obj.get_count_movies_month(month=month)
@app.get('/cantidad_filmaciones_dia/{day}')
async def get_count_movies_day(day: str):
"""Get the amount of movies released in the requested day.
Args:
day (str, optional): Released day. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return movies_obj.get_count_movies_day(day=day)
@app.get('/score_titulo/{title}')
async def get_score_title(title: str):
"""Get the released year and the score of the requested title.
Args:
title (str, optional): Movie to be searched. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return movies_obj.get_score_title(title=title)
@app.get('/votos_titulo/{title}')
async def get_votes_title(title: str):
"""Get the released year, vote count and vote average of the requested title.
Args:
title (str, optional): Movie to be searched. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return movies_obj.get_votes_title(title=title)
@app.get('/get_actor/{actor}')
async def get_actor(actor: str):
"""Get the actor movies, themaximun return ans the average return.
Args:
actor (str, optional): Actor to be searched. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return movies_obj.get_actor(actor=actor)
@app.get('/get_director/{director}')
async def get_director(director: str):
"""Get all the movies, released year, return, revenue and budget of the requested director.
Args:
director (str, optional): Director to be searched. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return movies_obj.get_director(director=director)
@app.get('/recomendacion/{title}')
async 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)