-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
33 lines (26 loc) · 773 Bytes
/
test.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
from subprocess import call
from pymongo import MongoClient
from flask import Flask, render_template
from webqueue import checkSite
from flask.ext.cors import CORS
from flask_socketio import SocketIO, emit
app = Flask(__name__)
cors = CORS(app, resources={r"/*": {"origins": "*"}})
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@socketio.on('connect')
def test_connect():
emit('my response', {'data': 'Connected'})
@socketio.on("res")
def getres(res):
client = MongoClient()
db = client.websites
emit("done", {})
collection = db.websites
emit("results", checkSite(res["url"], emit))
@app.route('/')
def hello_world():
return render_template('hello.html')
app.debug = True
if __name__ == '__main__':
socketio.run(app)