projects
/
osm
/
LW-UI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
user upadate: add/revoke project access
[osm/LW-UI.git]
/
lib
/
osm
/
osmclient
/
clientv2.py
diff --git
a/lib/osm/osmclient/clientv2.py
b/lib/osm/osmclient/clientv2.py
index
fa4117e
..
414019e
100644
(file)
--- a/
lib/osm/osmclient/clientv2.py
+++ b/
lib/osm/osmclient/clientv2.py
@@
-24,10
+24,13
@@
import StringIO
from lib.util import Util
import hashlib
import os
from lib.util import Util
import hashlib
import os
+from requests.packages.urllib3.exceptions import InsecureRequestWarning
-logging.basicConfig(level=logging.DEBUG)
-log = logging.getLogger('helper.py')
+requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
+logging.basicConfig(level=logging.INFO)
+log = logging.getLogger('helper.py')
+logging.getLogger("urllib3").setLevel(logging.INFO)
class Client(object):
def __init__(self):
class Client(object):
def __init__(self):
@@
-113,17
+116,16
@@
class Client(object):
'Authorization': 'Bearer {}'.format(token['id'])}
_url = "{0}/admin/v1/users/{1}".format(self._base_path, id)
'Authorization': 'Bearer {}'.format(token['id'])}
_url = "{0}/admin/v1/users/{1}".format(self._base_path, id)
- print _url
- print user_data
try:
try:
- r = requests.p
ost
(_url, json=user_data, verify=False, headers=headers)
+ r = requests.p
atch
(_url, json=user_data, verify=False, headers=headers)
except Exception as e:
log.exception(e)
result['data'] = str(e)
return result
except Exception as e:
log.exception(e)
result['data'] = str(e)
return result
- if r.status_code == requests.codes.
created
:
+ if r.status_code == requests.codes.
no_content
:
result['error'] = False
result['error'] = False
- result['data'] = Util.json_loads_byteified(r.text)
+ else:
+ result['data'] = Util.json_loads_byteified(r.text)
return result
def user_delete(self, token, id):
return result
def user_delete(self, token, id):