Python starter service
Project description
python-starter-service
This is a starter service project template. Use this template to create a new service project.
Getting started
First you need to provide ENV variables for the service to run.
ENV variables
Main ENV variables:
CLIENT_ID
- client id of the serviceREST_API_ENABLED
- enable/disable REST API (default:true
)
Kafka
CONSUME
- comma separated list of topics to consumePRODUCE
- comma separated list of topics to produceKAFKA_HOST
- kafka hostSCHEMA_REGISTRY
- schema registry host
Usage
Check the provided examples in the examples
folder.
Example
from starter_service import StarterService
class ExampleService(StarterService):
def health(self):
""" Health check endpoint """
return "OK"
def ready(self):
""" Ready check endpoint """
return True
def process(self, message):
""" Process message """
@API.post(consumer="article_raw_en", producer="metadata_item_key_en", doc="Process raw article and return metadata")
def handle_message(self, message: dict):
""" Process raw article and return metadata """
return {
"articleId": message['id'],
"origin": "string",
"data": [
{
"type": "string",
"value": "string",
"confidence": 0,
"metadata": {
"string": "string"
}
}
]
}
if __name__ == '__main__':
ExampleService()
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
Built Distribution
File details
Details for the file osint-python-starter-service-2.0.10.tar.gz
.
File metadata
- Download URL: osint-python-starter-service-2.0.10.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa66cb8bae330c455f2a3d8802798aa3e13d0857da938ac00ad19ece95791e24 |
|
MD5 | c1c9e31e4dc9a6b2e7e0dd531abd036b |
|
BLAKE2b-256 | 0ce3acbf30b7d6436f13870df33e6a1d081d29515f43b241f6975d681fa695e6 |
File details
Details for the file osint_python_starter_service-2.0.10-py3-none-any.whl
.
File metadata
- Download URL: osint_python_starter_service-2.0.10-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b44eafcd8f21eb55682fe47277e6f141862ef530cedf8d18cd1f39e85f95f1d |
|
MD5 | b1e3caf48079cd0e3fd787b0d992b1cb |
|
BLAKE2b-256 | 6ff371f5f8635f0e63a02d5c0047c127fdde90a03f20c507bec2eea79e2d715b |