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
  • 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
  • REST_API_ENABLED - enable/disable REST API

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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.0.2.tar.gz
Algorithm Hash digest
SHA256 28c5d5491c3c43858c35dff9864dad891d4f643a0efc6f4125449e02f7910715
MD5 aadc8aa2cbf1cf8eae3189b7612b6238
BLAKE2b-256 08de5910c6681d01df3fcf2e2ff8f7f23a94013a7fdfd4b280b45e532b46a959

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e180db75d3332ce1b48d78b2d310c8145eea00de2cb674f944fefa4524933518
MD5 5e06c571365b08d57cd2fe534abd74ae
BLAKE2b-256 5b9e0ad976de1d22775f4934962fba6968053850ed1822da3bcee5b1e1d22821

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