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 serviceCONSUME
- comma separated list of topics to consumePRODUCE
- comma separated list of topics to produceKAFKA_HOST
- kafka hostSCHEMA_REGISTRY
- schema registry hostREST_API_ENABLED
- enable/disable REST API
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.2.tar.gz
.
File metadata
- Download URL: osint-python-starter-service-2.0.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28c5d5491c3c43858c35dff9864dad891d4f643a0efc6f4125449e02f7910715 |
|
MD5 | aadc8aa2cbf1cf8eae3189b7612b6238 |
|
BLAKE2b-256 | 08de5910c6681d01df3fcf2e2ff8f7f23a94013a7fdfd4b280b45e532b46a959 |
File details
Details for the file osint_python_starter_service-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: osint_python_starter_service-2.0.2-py3-none-any.whl
- Upload date:
- Size: 20.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 | e180db75d3332ce1b48d78b2d310c8145eea00de2cb674f944fefa4524933518 |
|
MD5 | 5e06c571365b08d57cd2fe534abd74ae |
|
BLAKE2b-256 | 5b9e0ad976de1d22775f4934962fba6968053850ed1822da3bcee5b1e1d22821 |