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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.0.5.tar.gz
Algorithm Hash digest
SHA256 f7f075f8cd9ecf55260b684e507825bf3912f5b60666ce5b108850c36f54ff4e
MD5 7a3ca9d940558032634404f5c4a3bb4f
BLAKE2b-256 b071fb3295cef57e1b95640b7a22c3642ee54da47e08e47cde01155c51eabe9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6a5cbf826e88fb88c1384681fa50eae0cadb90028bbcb9d223ba31f77151100a
MD5 56f9557e02eceb0f8340aaf80edf0b9f
BLAKE2b-256 7ef60ad61141bcf79d304cfd23fb01ceafa76a85cdff21744b4855be02a737a0

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