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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.1.1.tar.gz
Algorithm Hash digest
SHA256 99cd1afc748d113aa14760898f6f0a47dc002a7ce221c95d02660c1526fba273
MD5 80f5f52d2c5176b1b4cf4d853a4d8575
BLAKE2b-256 669dd400d4095f3acfba7b34ca7ecf322e1bbd6761c51e6fe72d285010feb3aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c66f431f5db1e6d4b48b90621828c0785751e3ff3585d93022c8b08474f9f43
MD5 0ab621d198fd8e35644ceef10f81a69d
BLAKE2b-256 b7a254e8fd4c87b8e7201617df25aea436611e4ab4ba783ddfc1e2315a1c0493

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