olesku / eventhub-pyclient

Python client for Eventhub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eventhub-pyclient

Python client for Eventhub.

How to install

pip install git+https://github.com/olesku/eventhub-pyclient

Example

import asyncio
from eventhub_client import Eventhub

client = Eventhub("ws://localhost:8080", "myJWT")

async def topic1_callback(topic, message):
  print("Message received on %s: %s" % (topic,message))
  await client.disconnect()

async def main():
  await client.connect()
  await client.subscribe("topic1", topic1_callback)
  await client.publish("topic1", "FOO")

  while client.is_connected():
    await asyncio.sleep(1)

asyncio.run(main())

About

Python client for Eventhub

License:MIT License


Languages

Language:Python 98.5%Language:Makefile 1.5%