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.2.2.tar.gz
.
File metadata
- Download URL: osint-python-starter-service-2.2.2.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad10a6e34980c2fb7f6db1f37af43c8423569f78c914129f51e02bb424722362 |
|
MD5 | c6bc5e57ea61c6329e9a6f90cae40747 |
|
BLAKE2b-256 | c7f6795aed9d2a068000a46f51223fd464f7c71fbfc59b097971912194feb95e |
File details
Details for the file osint_python_starter_service-2.2.2-py3-none-any.whl
.
File metadata
- Download URL: osint_python_starter_service-2.2.2-py3-none-any.whl
- Upload date:
- Size: 22.8 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 | f2a55283ab4476ab5ae50e9207b85a653514ada63a224074d688ee4f16d3530d |
|
MD5 | 59b8531e15818aff56ae53bd95e97a3a |
|
BLAKE2b-256 | 7ee1cc3b520483996112e91a2595df2925610a79c55b54802138bab312e9f75b |