Quellcode durchsuchen

Adding timeout to http PUT

Andrej vor 1 Monat
Ursprung
Commit
e089d587cb
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      orthancInterface.py

+ 2 - 2
orthancInterface.py

@@ -77,7 +77,7 @@ class orthancInterface:
         except urllib3.exceptions.HTTPError as e:
             print(e)
 
-    def put(self,url,data,dataType='octet-stream'):
+    def put(self,url,data,dataType='octet-stream',timeout=None):
 
         debug=False
 
@@ -91,7 +91,7 @@ class orthancInterface:
         #headers["Cookie"]=self.cookie
 
         try:
-            return self.http.request('PUT',url,headers=headers,body=data)
+            return self.http.request('PUT',url,headers=headers,body=data,timeout=timeout)
         #f contains json as a return value
         except urllib3.exceptions.HTTPError as e:
             print(e)