-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (24 loc) · 823 Bytes
/
main.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
from flask import Flask, request
from flask_restful import Resource, Api
from utils.drive_files_data import DriveData
from utils.search import search_results
from flask_cors import CORS
app = Flask(__name__)
api = Api(app)
CORS(app)
class SearchKeyword(Resource):
def get(self, keywords):
search_result = search_results(keywords)
return search_result, 200
class GetDriveFiles(Resource):
def post(self):
data = request.get_json()
archive_data = DriveData.drive_details(data["link"])
return archive_data, 200
api.add_resource(SearchKeyword, '/search/<string:keywords>')
api.add_resource(GetDriveFiles, '/drive', endpoint = 'drive')
if "__main__" == __name__:
from waitress import serve
# app.run()
serve(app, host="0.0.0.0")
# app.run(debug=True)