Python implementation of the Nimiq RPC client specs.
To get started sending requests to a Nimiq node, we create a NimiqClient object.
import nimiqclient
client = NimiqClient(
scheme = "http",
user = "luna",
password = "moon",
host = "127.0.0.1",
port = 8648
)
# make rpc call to get current block number
blockNumber = client.blockNumber()
print(blockNumber)Note: When no config object is passed in the initialization it will use the default values in the Nimiq node.
The complete API documentation is available here.
Check out the original Nimiq RPC specs for the behind-the-scenes RPC calls.
Using PIP
pip install nimiqclientOr clone the repository and install the package from source
git clone https://github.com/nimiq-community/python-client
cd python-client
python setup.py installClone the repo and install it
git clone https://github.com/nimiq-community/python-client
cd python-client
python setup.py installAll done, happy coding!
You need a start a Testnet Nimiq node:
nodejs index.js --protocol=dumb --type=full --network=test --rpcTests are stored in the /tests folder and can be run from the command line like this:
python -m unittest discover -vThe documentation is generated automatically with Sphinx.
From the repository root directory install the development dependency requirements:
pip install -r requirements-dev.txtThen from the /docs directory run Sphinx via the make command:
cd docs
make htmlAdd a blank file in the /docs folder with the name .nojekyll for the documentation hosted on GitHub Pages:
touch .nojekyllThis implementation was originally contributed by rraallvv.
Bug reports and pull requests are welcome! Please refer to the issue tracker for ideas.