ui fix
[osm/LW-UI.git] / lib / osm / osmclient / clientv2.py
index 5e4f390..47c8e67 100644 (file)
@@ -180,6 +180,26 @@ class Client(object):
         result['data'] = Util.json_loads_byteified(r.text)
         return result
 
+    def project_edit(self, token, id, project_data):
+
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+
+        _url = "{0}/admin/v1/projects/{1}".format(self._base_path, id)
+
+        try:
+            r = requests.put(_url, json=project_data, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        print r.status_code
+        if r.status_code == requests.codes.no_content:
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def project_delete(self, token, id):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",