Skip to main content

Python MAPR Kafka REST wrapper

Project description

pymapr-kafkarest

Introduction

The aim of the project is to create a super-simple wrapper for MAPR Kafka REST proxy. We're trying to allow users to interact with MAPR Kafka in an elementary way and writing less code as possible.

The original documentation of the REST calls can be found here.

Installation

Soon available via pip:

pip install pymapr-kafkarest

Runtime configurations

  • KAFKAREST_LOG_LEVEL: allows to set the log level... default to DEBUG

TBC

Usage

Import the lib

from pymapr_kafkarest import MaprKlient

Define basic attributes

base_url = 'http://my-endopoint:8082'
user_group = 'foo'
topics = ['/streams/foo:bar']

and instantiate the client

mk = MaprKlient(base_url, user_group, topics=topics)

Connect, subscribe and consume messages as follows:

base_url = 'http://my-endopoint:8082'

if __name__ == '__main__':
    mk = MaprKlient(base_url, user_group, headers=headers, topics=topics)
    mk.connect(clear=True)
    mk.subscribe()
    
    messages = mk.consume()
    
    print(messages)

Connect and produce messages:

from pymapr_kafkarest import MaprKlient
from pymapr_kafkarest.kafkarest import MaprKProducer

base_url = 'https://localhost:8082'
headers = {}
user_group = 'me'

if __name__ == '__main__':

    # producing
    mp = MaprKProducer(base_url, user_group, headers=headers)

    msgs = [dict(key='0099', value=dict(color='red', shape='square'))]

    mp.produce(messages=msgs, topic='/streams/foo')

TODO

  • a lot of methods are not yet implemented
  • full read the docs
  • chain connect, subscribe and consume in a new method named stream

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

pymapr-kafkarest-0.1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

pymapr_kafkarest-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pymapr-kafkarest-0.1.1.tar.gz.

File metadata

  • Download URL: pymapr-kafkarest-0.1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pymapr-kafkarest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 86ef1a5c88cbbe7b81d89bb7a2d6058b079ee0cb69d3eeed47966e0d30600b59
MD5 c924f3437cf741c2e69e6248825dd6fa
BLAKE2b-256 aa6f3ca8f6e583a947e91584d060bf3bb2f4880bd2928b912f9e9474e089c4e9

See more details on using hashes here.

File details

Details for the file pymapr_kafkarest-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pymapr_kafkarest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2dd58d25a1a6f7d052685b3be2d125e813b7a61610e19833a620edc3052093de
MD5 8d6c5a32a966b92dc29f01ea8d85c354
BLAKE2b-256 b4cd7766805e198600aecbb995338ee6a089648a2741d2190b3283380b59eb65

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