blob: 832702c23550bb885a1dfaa6dd6b6ec2ad25b9f8 (
plain)
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
|
"""
The web application built on Flask is contained within this file.
When run as a script, the Flask development server is started.
"""
import os, socket
import submission_pb2, storage
from flask import Flask, request
from portage_processor import PortageProcessor
app = Flask(__name__)
store = storage.FilesystemStorage('logs/')
processors = {'portage' : PortageProcessor(None, store)} # TODO: initialise from config file
@app.route('/')
def index():
pass
@app.route('/submit', methods=['POST'])
def submit():
submission = submission_pb2.Submission()
submission.ParseFromString(request.data)
source = socket.getfqdn(request.remote_addr) # TODO: is this ok?
processors[submission.provider].process(submission, source)
return ''
if __name__ == '__main__':
app.run(host='::1', debug=True)
|