-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
53 lines (42 loc) · 1.02 KB
/
server.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
from flask import Flask, render_template
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/search/<name>')
def search(name):
from api.example import anime
result = None
while True:
try:
result = anime.search_animes(name)
break
except:
pass
return result
@app.route('/getdetails/<animeid>')
def get_details(animeid):
from api.example import anime
result = {'message': 'i don"t know shit'}
while True:
try:
result = anime.anime_details(animeid)
break
except:
pass
return result
@app.route('/stream/<animeid>/ep/<ep_no>')
def stream(animeid, ep_no):
from api.example import anime
test_result = ''
while True:
try:
test_result = anime.stream_anime(animeid, ep_no)
break
except:
pass
return test_result
if __name__ == "__main__":
app.run()