Commit 91b73e64 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

Send user data from flask to clery as a json object

parent 20ad1ed2
......@@ -18,6 +18,14 @@ app = create_app(config_name)
app.config['SECRET_KEY'] = vars.key
socketio = SocketIO(app, message_queue= vars.message_queue)
user_data = {
'username' : username
'fullname' : fullname
'reason' : reason
'session' : room
}
@socketio.on('connect')
def socket_connect():
pass
......@@ -39,7 +47,7 @@ def request_account(json, methods=['GET', 'POST']):
room = str(session['uid'])
print("Room: {}".format(room))
try:
tasks.celery_create_account.delay(json['username'], json['fullname'], json['reason'], session=room)
tasks.celery_create_account.delay(user_data)
except Exception as e:
print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e)
socketio.emit("Account creation failed", room)
......
......@@ -19,8 +19,11 @@ def send_msg(event, room):
@celery.task
def celery_create_account(username, fullname, reason, session):
room = session
def celery_create_account(user_data):
username = user_data.username
fullname = user_data.fullname
reason = user_data.reason
room = user_data.session
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
send_msg('creating account', room)
print(username)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment