Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
This is a Hedera Consensus Service (HCS) gRPC mirror node API Python client.
It only has functionality to subscribe to a HCS topic on mirror node.
For mirror node REST API, use curl or something like Python requests
.
For all other interactions with Hedera, use an SDK: Python, Java, Javascript, or Go.
import grpc
from hcs_grpc_client import TopicID, ConsensusTopic, ConsensusServiceStub
request = ConsensusTopicQuery(topicID=TopicID(2010293))
channel = grpc.insecure_channel("hcs.testnet.mirrornode.hedera.com:5600")
stub = ConsensusServiceStub(channel)
stream = stub.subscribeTopic(request)
for resp in stream:
# do whatever you need
print(resp)
Make sure the topic exists or create your own topic with an SDK. An example is given in examples/
.
See examples for mainnet example and other usages.
(Ignore this section unless you want to customized the client and/or want to contribute to this project)
Clone this repo:
git clone --recurse-submodules https://github.com/wensheng/hcs-grpc-api-py-client.git
Setup virtual env for python then install dependencies:
cd hcs-grpc-api-py-client
python3 -m venv venv
./venv/bin/python install -r requirements.txt
Generate code (compile .proto to .py):
./compile.sh # make sure deps.txt match compile_deps.sh
./compile_deps.sh
Build package:
rm -fr build dist
./venv/bin/python -m build
Test package:
./venv/bin/pip uninstall hcs-grpc-client
./venv/bin/pip install dist/hcs-grpc-client-(current_version)-py3-none-any.whl
Upload to Pypi (don't do this unless you're me):
python -m twine upload dist/*
FAQs
Hedera HCS gRPC API Python Client
We found that hcs-grpc-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.