auth-crawd: py3 compat
This commit is contained in:
parent
b148246ba8
commit
0937ed89a1
1 changed files with 13 additions and 13 deletions
|
|
@ -153,25 +153,25 @@ class CrowdServer(object):
|
|||
global msg
|
||||
msg = ""
|
||||
try:
|
||||
rdoc = self.opener.open(request)
|
||||
msg = "".join(rdoc.readlines())
|
||||
ret_doc = self.opener.open(request)
|
||||
msg = ret_doc.read()
|
||||
if not msg and empty_response_ok:
|
||||
rval = {}
|
||||
rval["status"] = True
|
||||
rval["error"] = "Response body was empty"
|
||||
ret_val = {}
|
||||
ret_val["status"] = True
|
||||
ret_val["error"] = "Response body was empty"
|
||||
elif not noformat:
|
||||
rval = json.loads(msg)
|
||||
rval["status"] = True
|
||||
ret_val = json.loads(msg)
|
||||
ret_val["status"] = True
|
||||
else:
|
||||
rval = "".join(rdoc.readlines())
|
||||
ret_val = msg
|
||||
except Exception as e:
|
||||
if not noformat:
|
||||
rval = {"status": False,
|
||||
"body": body,
|
||||
"error": str(e) + "\n" + msg}
|
||||
ret_val = {"status": False,
|
||||
"body": body,
|
||||
"error": "{}\n{}".format(e, msg)}
|
||||
else:
|
||||
rval = None
|
||||
return rval
|
||||
ret_val = None
|
||||
return ret_val
|
||||
|
||||
def user_auth(self, username, password):
|
||||
"""Authenticate a user against crowd. Returns brief information about
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue