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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.1.0.tar.gz
Algorithm Hash digest
SHA256 95e406d64dbdc9961f25a927929be8b5a6a8a671472b627209042be0d0bc1f6c
MD5 04a2ad734405ef1f8531a0981f799656
BLAKE2b-256 bc129e7ac1595a5baa563a5731dcdb1ff537260aebc24e06aac2dcdd0fdc7609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de00a2abdc77aefe107327192b2781ae1ce96794a9b0775afbc0034625de2d39
MD5 239d3ecf3dd0e12674be1e69accf6f18
BLAKE2b-256 fea61df29781df96b04cd0bb4659324fed21982f71212d60f7ef2c7dae52bbbc

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