-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.py
100 lines (70 loc) · 2.16 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
99
from fastapi import FastAPI
import uvicorn
from MoviesApi import *
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get('/')
def main():
return "Hello Friend!"
@app.get('/api/anime/{animeid}')
async def movies(animeid:str):
anime = HomeMoviesApi.anime(animeid=animeid)
return anime
@app.get('/api/movies/{page}')
async def movies(page:int):
movies = HomeMoviesApi.Movies(page=page)
return movies
@app.get('/api/tv-shows/{page}')
async def tvshows(page:int):
tvshows = HomeMoviesApi.TV(page=page)
return tvshows
@app.get('/api/top-imdb/movies/{page}')
async def topImdbMovies(page:int):
imdbmovies = HomeMoviesApi.TOPIMDBMOVIES(page=page)
return imdbmovies
@app.get('/api/top-imdb/tv-shows/{page}')
async def topImdbtv(page:int):
imdbtv = HomeMoviesApi.TOPIMDBTV(page=page)
return imdbtv
@app.get('/api/trending_movies')
def trending_movies():
trending_movies = HomeMoviesApi.trendingMovies(None)
return trending_movies
@app.get('/api/trending_tv')
def trending_tv():
trending_tv = HomeMoviesApi.trendingTV(None)
return trending_tv
@app.get('/api/popular_movies')
def popular_movies():
popular_movies = HomeMoviesApi.popularMovies(None)
return popular_movies
@app.get('/api/popular_tv')
def popular_tv():
popular_tv = HomeMoviesApi.popularTV(None)
return popular_tv
@app.get('/api/popular_movies')
def popular_movies():
popular_movies = HomeMoviesApi.popularMovies(None)
return popular_movies
@app.get('/api/latest_movies')
def latest_movies():
latest_movies = HomeMoviesApi.latestMovies(None)
return latest_movies
@app.get('/api/movie/{movie_id}')
async def movie_episode(movie_id : str):
movie_episode = HomeMoviesApi.moviesEpisode(movie_id=movie_id)
return movie_episode
@app.get('/api/tv/{tv_id}')
async def tv_episode(tv_id : str):
tv_episode = HomeMoviesApi.tvEpisode(tv_id=tv_id)
return tv_episode
if __name__== "__main__":
uvicorn.run(app, host="127.0.0.1", port=8080)