-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (25 loc) · 719 Bytes
/
app.py
File metadata and controls
31 lines (25 loc) · 719 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
from KickAssAPI import KickAssAPI
from flask import Flask, request, jsonify
API = KickAssAPI()
app = Flask(__name__)
@app.route('/')
def index():
return 'KickAssAPI up and running!'
@app.route('/search')
def search():
torrent = request.args.get('torrent')
if torrent:
resp = API.search(torrent)
return jsonify(resp)
else:
return jsonify({'error': 'No query provided'})
@app.route('/magnet')
def magnet():
page_url = request.args.get('page_url')
if page_url:
magnet_link = API.magnet(page_url)
return jsonify({'magnet': magnet_link})
else:
return jsonify({'error': 'No magnet provided'})
if __name__ == '__main__':
app.run(debug=True)