Skip to content

adrianhdez929/crown-pycurl

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

crown-pycurl

A simple python lib to interact with CRW nodes RPC using curl

Usage:

Standard Client

Example:

from crown_pycurl.client import Client

# Set your RPC access info
RPCUSER = 'your-rpc-user'
RPCPASS = 'your-rpc-passwd'
RPCHOST = 'your-rpc-host'

# Create a new instance of the client with the access info
client = Client(RPCUSER, RPCPASS, RPCHOST) # To use testnet just add a fourth boolean parameter as True

# Then just find the cli command you want to execute (in this example getinfo)
response = client.getinfo()

# The response is a JSON object with the same format as the crown-cli response
print(response['result'])

Secure Client

This is a beta feature, so it has been tested, but it still may have errors, so any feedback is very appreciated

Example:

import os
from crown_pycurl.secure import SecureClient

# Set your RPC access info
RPCUSER = 'your-rpc-user'
RPCPASS = 'your-rpc-passwd'
RPCHOST = 'your-rpc-host'

# Get your node SSH login data from environment
SSHUSER = os.environ.get(SSH_USER)
SSHPASS = os.environ.get(SSH_PASS)
SSHPORT = 21

# Set the local port to forward the SSH tunnel
LOCAL_PORT = 8000 

# Create a new instance of the client with the rpc access info and your ssh login data
client = SecureClient(RPCUSER, RPCPASS, LOCAL_PORT, SSHPORT, SSHUSER, SSHPASS, RPCHOST) # For testnet add the boolean param

# Execute the desired cli command just as in the standard client
response = client.getinfo()

# The response is a JSON object with the same format as the crown-cli response
print(response['result'])

About

A simple python lib to interact with CRW nodes RPC using curl

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages