-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for async TSaslClientTransport #297
Comments
It's not very hard to implement a async version of If you make it's done, please make a pull request and maybe we can merge it to the current codebase. |
I tried implementing this feature as the above guide suggests, but could not make it work. I suspected the way I test might be wrong, so I decided to write a test for the exisiting
export KRB5_KTNAME=/path/to/my.keytab
export KRB5_CLIENT_KTNAME=/path/to/my.keytab
export KRB5_CONFIG=/path/to/krb5.conf
kinit -kt /path/to/my.keytab my-name
klist -kt
python3 hbase_client_sync.py
import thriftpy2
import thriftpy2.rpc as rpc
import asyncio
from thriftpy2.transport import TSaslClientTransport
import sasl
HOST = 'hbase-thrift.mycompany.com'
PORT = 9090
USER = 'my-name'
class TSaslClientTransportFactory:
def get_transport(self, trans):
def make_sasl_client():
client = sasl.Client()
if not client.setAttr('host', HOST):
raise 'error'
if not client.setAttr('service', 'hbase'):
raise 'error'
if not client.setAttr('username', USER):
raise 'error'
if not client.setAttr('authname', USER):
raise 'error'
if not client.init():
raise 'error'
return client
return TSaslClientTransport(make_sasl_client, 'GSSAPI', trans)
hbase_thrift = thriftpy2.load("Hbase.thrift", module_name="hbase_thrift")
def request():
client = rpc.make_client(
hbase_thrift.Hbase, HOST, PORT, trans_factory=TSaslClientTransportFactory())
print(client.getTableNames())
client.close()
request()
It would be very helpful if someone could provide a working example of |
Our team used to rely on official python thrift client to access big data services (i.e. hbase, kafka, hive), through
sasl
authentication.We are planning to make everything
async
and thriftpy2 appears very suitable to our need af first glance.there is a TSaslClientTransport class for
sasl
authentication, but can't be used inasync
mode.TSaslClientTransport
, please provide oneasync
version of ofTSaslClientTransport
?async
andsasl
work together?The text was updated successfully, but these errors were encountered: