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

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.0.3.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.0.3.tar.gz
Algorithm Hash digest
SHA256 69cdd73f16148f311cb7d4ba3d2b3f27ad547e2f1e825bed0ba0a85b79afb3b4
MD5 5fc778a475af8a17a4883b470c26f28f
BLAKE2b-256 ff21906ac629f966445d4188eff085f473a32d3aedb1d16e5c545dfef1734d58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be2bee8007980b374c2cc4702f6dfbd6f54447dce11facde490edc6a55e60752
MD5 ae44e9b62c45b47ee1a70e68921bc675
BLAKE2b-256 1d4f2cd6d53b98d476fdd77afa17a5b5fd7aeee51437f5e4c6a68b3da0751d96

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