Skip to content
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

Add auth data for aiozk #35

Open
lyncir opened this issue Aug 19, 2019 · 0 comments
Open

Add auth data for aiozk #35

lyncir opened this issue Aug 19, 2019 · 0 comments

Comments

@lyncir
Copy link

lyncir commented Aug 19, 2019

Can you add auth_data when ZKClient instance like KazooClient(auth_data=auth_data)?
Or that would work not good?

For example:

class MyZKClient(ZKClient):

    def __init__(
            self,
            servers,
            chroot=None,
            session_timeout=10,
            default_acl=None,
            retry_policy=None,
            allow_read_only=False,
            read_timeout=None,
            loop=None,
            auth_data=None,
    ):
        super().__init__(servers, chroot, session_timeout, default_acl,
                         retry_policy, allow_read_only, read_timeout,
                         loop)
        self.auth_data = auth_data

    async def send(self, request):
        try:
            return await super().send(request)

        except NoAuth:

            if self.auth_data:
                await super().send(self.auth_data)

                return await super().send(request)


auth_data = AuthRequest(type=0, scheme='digest', auth=auth)
MyZKClient(zk_hosts, auth_data=auth_data)

but, still has some NoAuth error when use TreeCache

zookeeper: 3.4.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant