Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Krish Moodbidri
user-reg-cleanup
Commits
91b73e64
Commit
91b73e64
authored
Apr 10, 2020
by
Krish Moodbidri
Browse files
Send user data from flask to clery as a json object
parent
20ad1ed2
Changes
2
Hide whitespace changes
Inline
Side-by-side
run.py
View file @
91b73e64
...
...
@@ -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"
)
+
"
\t
Error in account creation: "
,
e
)
socketio
.
emit
(
"Account creation failed"
,
room
)
...
...
tasks.py
View file @
91b73e64
...
...
@@ -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"
)
+
'
\t
User '
+
username
+
' added to queue'
)
send_msg
(
'creating account'
,
room
)
print
(
username
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment