How to use the aiozk.exc function in aiozk

To help you get started, we’ve selected a few aiozk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github micro-fan / aiozk / aiozk / recipes / recipe.py View on Github external
async def create_znode(self, path):
        try:
            await self.client.create(path)
        except exc.NodeExists:
            pass
        except exc.NoNode:
            try:
                await self.ensure_path()
            except exc.NodeExists:
                pass
github micro-fan / aiozk / aiozk / recipes / recipe.py View on Github external
async def create_znode(self, path):
        try:
            await self.client.create(path)
        except exc.NodeExists:
            pass
        except exc.NoNode:
            try:
                await self.ensure_path()
            except exc.NodeExists:
                pass
github micro-fan / aiozk / aiozk / recipes / counter.py View on Github external
async def apply_operation(self, operation):
        success = False
        while not success:
            new_value = operation(self.value)
            data = str(new_value)
            try:
                stat = await self.client.set(self.base_path, data, self._version)
                log.debug("Operation '%s': successful", operation.__name__)
                self.value = new_value
                self._version = stat.version
                success = True
            except exc.BadVersion:
                await self._fetch()
                log.debug(
                    "Operation '%s': version mismatch, retrying",
                    operation.__name__
                )