Skip to main content

eventhubs

PyPI Changelog Tests License

CLI tool to send and receive event data from Azure Event Hubs

Installation

Install this tool using pip:

pip install eventhubs

Usage

Receiving

For receiving data to an event hub, run:

eh eventdata receive

Sending

For sending a single event to an event hub, run:

eh eventdata send-event --text '{"message": "Hello Spank"}'

You can also send multiple events in a batch by using the send-batch command with --text multiple times:

eh eventdata send-batch --text '{"message": "Hello Spank"}' --text '{"message": "Hello Spank (yes, again)"}'

For sending the lines in a text files as event, run:

eh eventdata send-batch --lines-from-text-file multiline.txt

For sending the lines from stdin as event, run:

cat multiline.txt | eh eventdata send-batch  

Configuration

You can set up the connection string and event hub name using the command line options:

eh eventdata receive --connection-string "Endpoint=.." --name "application-insights"

or the environment variables (or a mix of both):

export EVENTHUB_CONNECTION_STRING="Endpoint=sb://...="
export EVENTHUB_NAME="application-insights"

eh eventdata receive

eh eventdata receive --name "another-name"

Defaults to printing the message payload only, so it is easier to combine output with other tools, like jq:

$ eh eventdata receive | jq '.records[].tenantId' 
"1de2b364-21e1-4866-bb46-7804f17c417d"
"1de2b364-21e1-4866-bb46-7804f17c417d"
"1de2b364-21e1-4866-bb46-7804f17c417d"

But you can still turn on verbose and get more information about what's going on:

$ eh --verbose eventdata receive
Receiving events from mbranca
Received event from partition 0: {"records": [{....

For help, run:

eventhubs --help

You can also use:

python -m eventhubs --help

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd eventhubs
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Metadata

Release files for eventhubs 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eventhubs 0.4
File Size Uploaded Provenance
eventhubs-0.4.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eventhubs 0.4
File Interpreter ABI Platform
eventhubs-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / eventhubs-0.4.tar.gz

Download URL eventhubs-0.4.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ff92bbe75990e735ff083dac4f7874511ba2b1405d3e979318cd34ee48510abe
BLAKE2b-256 checksum
How to use checksums
702e7c8241a0286d4d6d95cc9f7168d84a5c695c4f8bd1b8e48d1b1504af54da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / eventhubs-0.4-py3-none-any.whl

Download URL eventhubs-0.4-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ebd300a5715b5f6623913b8253c4d250c6b4af9eb7e7ec25c96df23f435992a
BLAKE2b-256 checksum
How to use checksums
f9e520b3884ee429fa33e1c21420136144bbca4eff5ef18d1cafc37c9b86dc4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for eventhubs 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page