-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (29 loc) · 927 Bytes
/
main.py
File metadata and controls
40 lines (29 loc) · 927 Bytes
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
from typing import Union
from funcs import *
from fastapi import FastAPI
from urllib.parse import unquote
app = FastAPI()
@app.get("/movies/name:{star}")
def api_movies_from_star(star: str,):
name = unquote(star)
result = all_movies_from_star(name)
return {"name": result}
@app.get("/movies/random")
def api_random_movie():
result = random_movie()
return {"movie": result}
@app.get("/movies/year:{year}")
def api_movies_from_year(year: str,):
year = unquote(year)
result = movies_from_year(year)
return {"movies": result}
@app.get("/movies/year/before/year:{year}")
def api_movies_before_year(year: str,):
year = unquote(year)
result = movies_from_year_before(year)
return {"movies": result}
@app.get("/movies/year/after/year:{year}")
def api_movies_before_year(year: str,):
year = unquote(year)
result = movies_from_year_after(year)
return {"movies": result}