THRIFT-155. python: Reopen THttpClient on a flush


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757996 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/transport/THttpClient.py b/lib/py/src/transport/THttpClient.py
index 48f75a4..f577192 100644
--- a/lib/py/src/transport/THttpClient.py
+++ b/lib/py/src/transport/THttpClient.py
@@ -37,6 +37,10 @@
     self.__wbuf.write(buf)
 
   def flush(self):
+    if self.isOpen():
+      self.close()
+    self.open();
+
     # Pull data out of buffer
     data = self.__wbuf.getvalue()
     self.__wbuf = StringIO()