[query] add fields list to query
This commit is contained in:
parent
ceb0b075de
commit
8930e065d2
|
@ -0,0 +1,3 @@
|
||||||
|
DEV=1
|
||||||
|
DEBUG=1
|
||||||
|
DEBUG_ACL=public
|
|
@ -70,7 +70,7 @@ def parse_query(q: str = ""):
|
||||||
split_ = lambda x : x.split(':')
|
split_ = lambda x : x.split(':')
|
||||||
params = dict(map(split_, q.split('|')))
|
params = dict(map(split_, q.split('|')))
|
||||||
|
|
||||||
def select(obj):
|
def select(obj, fields = []):
|
||||||
|
|
||||||
if 'limit' in params and int(params['limit']) > 0:
|
if 'limit' in params and int(params['limit']) > 0:
|
||||||
obj.limit(int(params['limit']))
|
obj.limit(int(params['limit']))
|
||||||
|
@ -78,6 +78,6 @@ def parse_query(q: str = ""):
|
||||||
if 'offset' in params and int(params['offset']) > 0:
|
if 'offset' in params and int(params['offset']) > 0:
|
||||||
obj.offset(int(params['offset']))
|
obj.offset(int(params['offset']))
|
||||||
|
|
||||||
return [elt for elt in obj.select()]
|
return [elt for elt in obj.select(*fields)]
|
||||||
|
|
||||||
return select
|
return select
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
|
||||||
|
r = requests.post('http://127.0.0.1:3000/auth',
|
||||||
|
data={'email':'dhenaut', 'password':'a'})
|
||||||
|
r_obj = json.loads(r.text)
|
||||||
|
token = r_obj['token']
|
||||||
|
print(token)
|
Loading…
Reference in New Issue