Is this the initial commit? I forgot
This commit is contained in:
14
data_management.py
Normal file
14
data_management.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import config
|
||||
import json
|
||||
|
||||
def get_data(data_type, key, value):
|
||||
if data_type == 'users':
|
||||
users_json_string = open('data/users.json', 'r').read()
|
||||
json_data = json.loads(users_json_string)
|
||||
for json_object in json_data:
|
||||
if json_object[key] == value:
|
||||
return json_object
|
||||
|
||||
return -1
|
||||
|
||||
|
Reference in New Issue
Block a user