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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.0.1.tar.gz
Algorithm Hash digest
SHA256 53f961868fd21ff367bcfc2185eae465b568f7a35873266c0b5f6dd7ecaa9112
MD5 d7ce3946d87cb0f074082e733be7cb79
BLAKE2b-256 9e3883ab30078df705586ee6d71fda984067999950998cf7f106288e2c36ab4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7da09f091529b3e5f260fc6164ec729cefc9390a75e343d51dfbfcd1397cd6dc
MD5 651c1aee1850a13a15ac32df2fccf216
BLAKE2b-256 ee83cff919c33fe5d1f411c5fe0a37f458b21705021f406cc61c9c031c5ce641

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