Skip to main content

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 service
  • REST_API_ENABLED - enable/disable REST API (default: true)

Kafka

  • CONSUME - comma separated list of topics to consume
  • PRODUCE - comma separated list of topics to produce
  • KAFKA_HOST - kafka host
  • SCHEMA_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osint-python-starter-service-2.2.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file osint-python-starter-service-2.2.0.tar.gz.

File metadata

File hashes

Hashes for osint-python-starter-service-2.2.0.tar.gz
Algorithm Hash digest
SHA256 fd46ba239d2c908b793f195db25c68a0f752430fd210fe6ba770f43a2352569b
MD5 d27ff70da8c8fafbe9f46e937154818e
BLAKE2b-256 0c2f3a22ceb43f4b155a1f12312b6d4155717856ff3e4ce531af16120fac523c

See more details on using hashes here.

File details

Details for the file osint_python_starter_service-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for osint_python_starter_service-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 063532166474eed9a0b139b394ce36cb2b296c1bdac13697474d67b38396d248
MD5 d98ee6180c29c4c8b6799f0ab30cd174
BLAKE2b-256 5779b3533ee204b2f0012714358f253c22e69d63037503edbcb60f971f123383

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page