Andrej 4 anni fa
parent
commit
6ed607fb43
2 ha cambiato i file con 20 aggiunte e 0 eliminazioni
  1. 4 0
      labkeyFileBrowser.py
  2. 16 0
      labkeyInterface.py

+ 4 - 0
labkeyFileBrowser.py

@@ -66,4 +66,8 @@ class labkeyFileBrowser:
         if len(path)==0:
             return url
         return url+'/'+path
+
+    def mkdir(self,url):
+        self.net.mkcol(url)
+
         

+ 16 - 0
labkeyInterface.py

@@ -80,6 +80,22 @@ class labkeyInterface:
         except urllib3.exceptions.HTTPError as e:
             print(e)
 
+    def mkcol(self,url):
+
+        debug=False
+        headers=urllib3.util.make_headers(basic_auth=self.getBasicAuth())
+        #add csrf;also sets self.cookie
+        headers["X-LABKEY-CSRF"]=self.getCSRF()
+        headers["Cookie"]=self.cookie
+
+        try:
+            return self.http.request('MKCOL',url,headers=headers)
+        #f contains json as a return value
+        except urllib3.exceptions.HTTPError as e:
+            print(e)
+
+
+
     def put(self,url,data):
 
         debug=False