diff options
author | Muriithi Frederick Muriuki | 2018-01-19 10:38:04 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2018-01-19 10:38:04 +0300 |
commit | 7282e0b47c1c6d12fc4c06a080af07c8e67ca75c (patch) | |
tree | 9e2f514c5958bc805a1df5e9cb5819360b9f228c /wqflask/utility | |
parent | 63a5c8a42ad02e9126bb207465ff5eca98f6515d (diff) | |
download | genenetwork2-7282e0b47c1c6d12fc4c06a080af07c8e67ca75c.tar.gz |
Add save_user() function
* On successful login via OAuth2, save the details of the user in
elasticsearch store, to avoid hitting the external provider for the
basic details.
Diffstat (limited to 'wqflask/utility')
-rw-r--r-- | wqflask/utility/elasticsearch_tools.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/wqflask/utility/elasticsearch_tools.py b/wqflask/utility/elasticsearch_tools.py index bc7bb240..74db489b 100644 --- a/wqflask/utility/elasticsearch_tools.py +++ b/wqflask/utility/elasticsearch_tools.py @@ -20,3 +20,10 @@ def get_user_by_unique_column(column_name, column_value): except TransportError as te: pass return user_details + +def save_user(user, user_id, index="users", doc_type="local"): + es = Elasticsearch([{ + "host": ELASTICSEARCH_HOST + , "port": ELASTICSEARCH_PORT + }]) + es.create(index, doc_type, body=user, id=user_id) |