A Python package based on web3.py to interact with cpchain.
- Python 3.5+ support
cpc_fusion.py can be installed (preferably in a virtualenv) using pip
as follows:
pip install cpc-fusion
Installation from source can be done from the root of the project with the following command.
pip install .
To use the web3 library you will need to initialize the Web3
class.
Use the auto
module to guess at common node connection options.
from cpc_fusion import Web3
cf = Web3(Web3.HTTPProvider('http://127.0.0.1:8501'))
cf.cpc.blockNumber
>>> 34341
Note
If you get the result UnhandledRequest: No providers responded to the RPC request
then you are not connected to a node.
Read more in the documentation on CPChain.