|
@@ -1,6 +1,6 @@
|
|
|
import urllib3
|
|
|
import xml.etree.ElementTree as ET
|
|
|
-
|
|
|
+import shutil
|
|
|
|
|
|
class labkeyFileBrowser:
|
|
|
|
|
@@ -47,7 +47,19 @@ class labkeyFileBrowser:
|
|
|
return True,dirs
|
|
|
|
|
|
def readFileToBuffer(self, url):
|
|
|
- return self.net.get(url)
|
|
|
+ return self.net.get(url,binary=True)
|
|
|
+
|
|
|
+ def readFileToFile(self,url,path):
|
|
|
+ response=self.readFileToBuffer(url)
|
|
|
+ with open(path,'wb') as out_file:
|
|
|
+ shutil.copyfileobj(response,out_file)
|
|
|
+ response.release_conn()
|
|
|
+
|
|
|
+ def writeFileToFile(self,path,url):
|
|
|
+ with open(path,'rb') as f:
|
|
|
+ data=f.read()
|
|
|
+ self.net.put(url,data)
|
|
|
+
|
|
|
|
|
|
def formatPathURL(self,project,path):
|
|
|
url=self.GetRootUrl()+'/'+project+'/@files'
|