Преглед изворни кода

Adding timeout to http PUT

Andrej пре 1 месец
родитељ
комит
e089d587cb
1 измењених фајлова са 2 додато и 2 уклоњено
  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)