How to use the kombu.utils.encoding.str_to_bytes function in kombu

To help you get started, we’ve selected a few kombu 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 celery / kombu / kombu / transport / filesystem.py View on Github external
def _put(self, queue, payload, **kwargs):
        """Put `message` onto `queue`."""
        filename = '%s_%s.%s.msg' % (int(round(monotonic() * 1000)),
                                     uuid.uuid4(), queue)
        filename = os.path.join(self.data_folder_out, filename)

        try:
            f = open(filename, 'wb')
            lock(f, LOCK_EX)
            f.write(str_to_bytes(dumps(payload)))
        except (IOError, OSError):
            raise ChannelError(
                'Cannot add file {0!r} to directory'.format(filename))
        finally:
            unlock(f)
            f.close()
github celery / kombu / kombu / transport / virtual / base.py View on Github external
def encode(self, s):
        return bytes_to_str(base64.b64encode(str_to_bytes(s)))
github celery / kombu / t / integration / transport.py View on Github external
def _digest(self, data):
        return _digest(str_to_bytes(data)).hexdigest()
github celery / django-celery / djcelery / picklefield.py View on Github external
def maybe_compress(value, do_compress=False):
    if do_compress:
        return compress(str_to_bytes(value))
    return value
github celery / celery / celery / utils / serialization.py View on Github external
def b64encode(s):
    return bytes_to_str(base64encode(str_to_bytes(s)))
github etalab / croquemort / croquemort / storages.py View on Github external
def get_group(self, group_hash):
        return self.database.hgetall(str_to_bytes(group_hash))
github celery / django-celery / djcelery / picklefield.py View on Github external
def maybe_decompress(value, do_decompress=False):
    if do_decompress:
        if str_to_bytes(value[:15]) != NO_DECOMPRESS_HEADER:
            return decompress(str_to_bytes(value))
    return value