X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FLW-UI.git;a=blobdiff_plain;f=lib%2Fosm%2Fosmclient%2Fclientv2.py;h=5e4f390f9bb185dff98c9782175e102d667da5bc;hp=536ef652b5649822eee75f643f9186381536b786;hb=835a0b7c317c0ad76a15f90acd01571cb1f62eb3;hpb=2ad37de399d1f309e265c060349ce44f80d8f480 diff --git a/lib/osm/osmclient/clientv2.py b/lib/osm/osmclient/clientv2.py index 536ef65..5e4f390 100644 --- a/lib/osm/osmclient/clientv2.py +++ b/lib/osm/osmclient/clientv2.py @@ -110,6 +110,22 @@ class Client(object): result['data'] = Util.json_loads_byteified(r.text) return result + def get_user_info(self, token, id): + result = {'error': True, 'data': ''} + headers = {"Content-Type": "application/yaml", "accept": "application/json", + 'Authorization': 'Bearer {}'.format(token['id'])} + _url = "{0}/admin/v1/users/{1}".format(self._base_path, id) + try: + r = requests.get(_url, params=None, verify=False, stream=True, headers=headers) + except Exception as e: + log.exception(e) + result['data'] = str(e) + return result + if r.status_code == requests.codes.ok: + result['error'] = False + result['data'] = Util.json_loads_byteified(r.text) + return result + def project_list(self, token): result = {'error': True, 'data': ''} headers = {"Content-Type": "application/yaml", "accept": "application/json", @@ -142,6 +158,7 @@ class Client(object): if r.status_code == requests.codes.ok: result['error'] = False result['data'] = Util.json_loads_byteified(r.text) + return result def project_create(self, token, project_data):