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
Release history Release notifications | RSS feed
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.1.tar.gz
(6.9 kB
view hashes)
Built Distribution
Close
Hashes for gcn_kafka-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81ad0465a458905659de9eece2449a260de24e44bf73d6c2d2f88b113d0f871e |
|
MD5 | 1538d4dcd63a96b145c1711280717106 |
|
BLAKE2b-256 | 1e2cfef21ab9f4e08a6d6ad6d7421a960b4dcb05116e39f11eae3bc85d55d817 |