[
https://issues.apache.org/jira/browse/THRIFT-1852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
zhang shen peng updated THRIFT-1852:
------------------------------------
Description:
TZlibTransport seems should reset after every flush (with THttpClient) ?
Else , the frist time call are right ; the second time call raise error ?
Is this a bug to fix ?
{code:python}
import _env
from thrift import Thrift
from thrift.transport import TTransport
from thrift.transport.TZlibTransport import TZlibTransport as _TZlibTransport
from thrift.protocol.TCompactProtocol import TCompactProtocol as Protocol
from thrift.transport.THttpClient import THttpClient
from zlib import decompress
import zlib
class TZlibTransport(_TZlibTransport):
def flush(self):
result = _TZlibTransport.flush(self)
self._reinit_buffers()
self._init_zlib()
self._init_stats()
return result
def saas_client(saas, host="127.0.0.1", port=80):
transport = THttpClient("http://%s:%s/" % (host, port))
transport.setTimeout(5000)
transport = TZlibTransport(transport)
transport.open()
protocol = Protocol(transport)
client = saas.Client(protocol)
return transport, client
if __name__ == "__main__":
from misc.saas.xi.saas import Interface
import time
transport, client = saas_client(Interface, "saas-xi.42qu.me")
while True:
print client.poListBeforeByUserId(1)
time.sleep(1)
{code}
was:
TZlibTransport seems should reset after every flush (with THttpClient) ?
Else , the frist time call are right ; the second time call raise error ?
Is this a bug to fix ?
import _env
from thrift import Thrift
from thrift.transport import TTransport
from thrift.transport.TZlibTransport import TZlibTransport as _TZlibTransport
from thrift.protocol.TCompactProtocol import TCompactProtocol as Protocol
from thrift.transport.THttpClient import THttpClient
from zlib import decompress
import zlib
class TZlibTransport(_TZlibTransport):
def flush(self):
result = _TZlibTransport.flush(self)
self._reinit_buffers()
self._init_zlib()
self._init_stats()
return result
def saas_client(saas, host="127.0.0.1", port=80):
transport = THttpClient("http://%s:%s/" % (host, port))
transport.setTimeout(5000)
transport = TZlibTransport(transport)
transport.open()
protocol = Protocol(transport)
client = saas.Client(protocol)
return transport, client
if __name__ == "__main__":
from misc.saas.xi.saas import Interface
import time
transport, client = saas_client(Interface, "saas-xi.42qu.me")
while True:
print client.poListBeforeByUserId(1)
time.sleep(1)
> TZlibTransport can't work together with THttpClient ? (python client)
> ---------------------------------------------------------------------
>
> Key: THRIFT-1852
> URL: https://issues.apache.org/jira/browse/THRIFT-1852
> Project: Thrift
> Issue Type: Bug
> Components: Python - Library
> Affects Versions: 0.9
> Reporter: zhang shen peng
>
> TZlibTransport seems should reset after every flush (with THttpClient) ?
> Else , the frist time call are right ; the second time call raise error ?
> Is this a bug to fix ?
> {code:python}
> import _env
> from thrift import Thrift
> from thrift.transport import TTransport
> from thrift.transport.TZlibTransport import TZlibTransport as _TZlibTransport
> from thrift.protocol.TCompactProtocol import TCompactProtocol as Protocol
> from thrift.transport.THttpClient import THttpClient
> from zlib import decompress
> import zlib
> class TZlibTransport(_TZlibTransport):
> def flush(self):
> result = _TZlibTransport.flush(self)
> self._reinit_buffers()
> self._init_zlib()
> self._init_stats()
> return result
> def saas_client(saas, host="127.0.0.1", port=80):
> transport = THttpClient("http://%s:%s/" % (host, port))
> transport.setTimeout(5000)
> transport = TZlibTransport(transport)
> transport.open()
> protocol = Protocol(transport)
> client = saas.Client(protocol)
> return transport, client
> if __name__ == "__main__":
> from misc.saas.xi.saas import Interface
> import time
> transport, client = saas_client(Interface, "saas-xi.42qu.me")
> while True:
> print client.poListBeforeByUserId(1)
> time.sleep(1)
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira