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)](https://gcn.nasa.gov). It is a very lightweight wrapper around [confluent-kafka-python](https://docs.confluent.io/platform/current/clients/confluent-kafka-python/html/index.html).
## To Install
Run this command to install with [pip](https://pip.pypa.io/):
` pip install gcn-kafka `
## To use
Create a consumer:
`pycon >>> from gcn_kafka import Consumer >>> consumer = Consumer(client_id='fill me in', client_secret='fill me in') `
List all topics:
`pycon >>> 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:
`pycon >>> 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
Built Distribution
Hashes for gcn_kafka-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8af4b0ec0cdf931c4fe5dc617e5317f8dd42e6ea362c3f7861b84a09d4983963 |
|
MD5 | bb93dc22fa79c1286c80bd9493490bea |
|
BLAKE2b-256 | f2a7de15d90444eac1e675be96fe33f59ffae2173d1fb6c1221708083db394b9 |