How to use the escpos.retry.backoff function in escpos

To help you get started, we’ve selected a few escpos 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 base4sistemas / pyescpos / escpos / conn / network.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def catch(self):
        return self._raw_catch()
github base4sistemas / pyescpos / escpos / conn / bt.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def release(self):
        if self.socket is not None:
            self.socket.shutdown(socket.SHUT_RDWR)
            self.socket.close()
            self.socket = None
github base4sistemas / pyescpos / escpos / conn / network.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def read(self):
        return self._raw_read()
github base4sistemas / pyescpos / escpos / conn / bt.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def read(self):
        try:
            return self.socket.recv()
        except:
            logger.exception('read error')
            return ''
github base4sistemas / pyescpos / escpos / conn / network.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def release(self):
        return self._raw_release()
github base4sistemas / pyescpos / escpos / conn / bt.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def catch(self):
        self.socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
        self.socket.connect((self.address, self.port))
github base4sistemas / pyescpos / escpos / conn / network.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def write(self, data):
        return self._raw_write(data)
github base4sistemas / pyescpos / escpos / conn / bt.py View on Github external
    @backoff(
            max_tries=config.retry.max_tries,
            delay=config.retry.delay,
            factor=config.retry.factor,
            exceptions=_RETRY_EXCEPTIONS)
    def write(self, data):
        totalsent = 0
        while totalsent < len(data):
            sent = self.socket.send(data[totalsent:])
            if sent == 0:
                self._raise_with_details('socket connection broken')
            totalsent += sent