Skip to main content

Kafka client for NASA's General Coordinates Network (GCN)

Project description

GCN Kafka Client for Python

This is the official Python client for the General Coordinates Network (GCN). It is a very lightweight wrapper around confluent-kafka-python.

To Install

Run this command to install with pip:

pip install gcn-kafka

To use

Create a consumer:

>>> from gcn_kafka import Consumer
>>> consumer = Consumer(client_id='fill me in', client_secret='fill me in')

List all topics:

>>> print(consumer.list_topics().topics)
{'gcn.classic.text.CALET_GBM_FLT_LC': TopicMetadata(gcn.classic.text.CALET_GBM_FLT_LC, 1 partitions), 'gcn.classic.voevent.FERMI_GBM_SUBTHRESH': TopicMetadata(gcn.classic.voevent.FERMI_GBM_SUBTHRESH, 1 partitions), ...}

Subscribe to topics and receive alerts:

>>> consumer.subscribe(['gcn.classic.text.FERMI_GBM_FIN_POS', 'gcn.classic.text.LVC_INITIAL'])
>>> while True:
...     for message in consumer.consume():
...         print(message.value())

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

gcn-kafka-0.1.2.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

gcn_kafka-0.1.2-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

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