Changeset View
Changeset View
Standalone View
Standalone View
pykolab/wap_client/__init__.py
Show First 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | def request_raw(method, api_uri, get=None, post=None, headers={}, isretry=False): | ||||
# retry with a new connection | # retry with a new connection | ||||
if reconnect: | if reconnect: | ||||
disconnect() | disconnect() | ||||
return request_raw(method, api_uri, get, post, headers, True) | return request_raw(method, api_uri, get, post, headers, True) | ||||
try: | try: | ||||
response_data = json.loads(data) | response_data = json.loads(data) | ||||
except ValueError, e: | except ValueError: | ||||
# Some data is not JSON | # Some data is not JSON | ||||
log.error(_("Response data is not JSON")) | log.error(_("Response data is not JSON")) | ||||
return response_data | return response_data | ||||
def resource_add(params=None): | def resource_add(params=None): | ||||
if params == None: | if params == None: | ||||
params = get_user_input() | params = get_user_input() | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | def user_edit(user = None, attributes={}): | ||||
return user_edit | return user_edit | ||||
def user_find(attribs=None): | def user_find(attribs=None): | ||||
if attribs == None: | if attribs == None: | ||||
post = { | post = { | ||||
'search': { | 'search': { | ||||
'params': { | 'params': { | ||||
utils.ask_question("Attribute") : { | utils.ask_question("Attribute") : { | ||||
Lint: PEP8 E203: whitespace before ':' | |||||
'value': utils.ask_question("value"), | 'value': utils.ask_question("value"), | ||||
'type': 'exact' | 'type': 'exact' | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
else: | else: | ||||
post = { 'search': { 'params': {} } } | post = { 'search': { 'params': {} } } | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |
whitespace before ':'