Open Robbie-Palmer opened 1 year ago
Hello @Robbie-Palmer
I've forked the code, modernized it (replaced hyper with HTTPX, bumped all dependencies, updated to Python 3.9 as the minimal version, and fixed all the tests to behave with latest KSQL DB versions (0.29.0). Could you check if it's still present in my version?
https://github.com/sheinbergon/ksql-python-ng
I'll be making a PYPI release soon enough. In the meanwhile, you can test it by running
pipx install git+https://github.com/sheinbergon/ksql-python-ng.git --include-deps
or
pip install git+https://github.com/sheinbergon/ksql-python-ng.git
I am getting a socket timeout error on calling
inserts_stream
, and I am unable to increase the default socket timeout Thetimeout
parameter inKSQLAPI
's constructor does not affectinserts_stream
timeout
is used to construct aSimplifiedAPI
object This is only used in the parent classBaseApi
in its_request
function, which usesHTTP/1
withurllib
TheseHTTP/1
calls are used by thequery
andksql
functionsThe
timeout
is not used byHTTP/2
calls TheHTTP/2
calls depend on Hyper, which had an issue requesting support for timeouts, but it appears it wasn't addressed before the repo was deprecated This affects theinserts_stream
function andquery
whenuse_http2=True
Due to
hyper
's deprecation it is advised to migrate tohttpx
which is discussed in #102 This was started but abandoned in #107 This was published topypi
as https://pypi.org/project/pykSQL/0.11.0/, but it doesn't work as callinginserts_stream
causes a bad request from ksql saying'{"@type":"generic_error","error_code":40004,"message":"This endpoint is only available when using HTTP2"}'
If the migration to
httpx
is completed, then it is simple to pass the same timeout forHTTP/2
requests ashttpx
supports thisresponse = httpx.post(url, data=row, headers=headers, timeout=self.timeout)