python plugin system for jr, the data random generator
Project description
Python Plugin package for JR, the data random generator
This package implements a framework to write a producer plugin for JR in python.
Example
A simple plugin can be written as follows:
import logging
import python_jr.jrplugin as jr
import python_jr.producer_pb2 as pb2
# Define a logger with the correct level
logger = jr.Logger(logging_level=logging.DEBUG)
log = logger.log
class MyProducer(jr.JRProducer):
def Produce(self, request, context):
key = request.key.decode("utf-8")
value = request.value.decode("utf-8")
# do something with the key and value
# return a response
response = pb2.ProduceResponse()
response.bytes = len(request.value)
response.message = "Some message"
return response
if __name__ == "__main__":
jr.serve(MyProducer(), logger)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_jr-2.0.2.tar.gz
(6.4 kB
view details)
Built Distribution
python_jr-2.0.2-py3-none-any.whl
(11.5 kB
view details)
File details
Details for the file python_jr-2.0.2.tar.gz
.
File metadata
- Download URL: python_jr-2.0.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.9.12 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae081c418141927eeabe13aa0a869fb9049fa9a2f5450bd169317e4816b2020 |
|
MD5 | d271c712cfcd30b0abf5a827b733a07f |
|
BLAKE2b-256 | 3f292236ebf9deaf7ede4168cc8fbc225601850277ed288f505572cc67ab2c03 |
File details
Details for the file python_jr-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: python_jr-2.0.2-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.9.12 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db42a093e375728414f7e512a95097db928102fa7e3e70acf6b38dc438cf5915 |
|
MD5 | d6073631bd7fdb5e78d52949cb3826b0 |
|
BLAKE2b-256 | 0e8469d78462ce2863c9242e058177d113ae1aa64926b849905d7e76ab22a2fc |