-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
39 lines (29 loc) · 940 Bytes
/
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
from bottle import Bottle, static_file, response, request, template, run
from scrapeImport import scrape
import os
# # Get required port, default to 5000.
# port = os.environ.get('PORT', 5000)
# # Run the app.
# run(host='0.0.0.0', port=port)
app = Bottle()
tournamentName = "None"
@app.route('/')
def index():
return template("index.tpl", {'tournament':tournamentName})
@app.post('/')
def formhandler():
tournamentURL = request.forms.get('input')
# print(tournament)
tournamentName = scrape(tournamentURL)
return template("index.tpl", {'tournament':tournamentName})
@app.route("/about")
def about():
# scrape(link)
response.content_type = 'text/plain'
return "hii"
@app.route("/downloadFile")
def download():
return static_file('speaks.xlsx', root='', download='speaks.xlsx')
if __name__ == '__main__':
port = os.environ.get('PORT', 5000)
app.run(host='0.0.0.0', port=port, debug=True)