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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for osint-python-starter-service-2.0.7.tar.gz
Algorithm Hash digest
SHA256 aa862ed5932cd6c4f17d838c959e04588d68f915f3b111d97b4c926a16b19045
MD5 5ca72da56a1348474e1089abde07ab0b
BLAKE2b-256 a28665fc1078061eb44a6cd8bad5d8bc5a650f33b500c2f5d4f3e286e17f600d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for osint_python_starter_service-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9278df68b5445d9a28fd77e14d503e5fa07fda246c8eca78752255d27f2cb30d
MD5 5089ca97ce020692a93287b5b239ea0b
BLAKE2b-256 2a33bf81df3fcc29881887aff3877a647d653df3427c7d698d1d2b51a0ea0c37

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