I'm trying this and it's not working
curl -X POST -H "Content-Type: application/json" -d '{"id":0,"jsonrpc":"2.0","method":"miner_getstat1"}' http://IP:3333
I didn't make it with curl but I made it with python I had to add a newline character \n at the end of the request.
like this {"id":0,"jsonrpc":"2.0","method":"miner_getstat1"}\n
Hey Germini,
Can you post your code please?
I found one python code somewhere here, but neither with \n it does not working :/
Hi, no problem with this code you can get all the data from a claymore or phoenixminer with no problem using python. thanks to (https://github.com/pistonov/RedTools-Rig-Light)
import json
def get_data(ip, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = (ip, int(port))
try:
sock.connect(server_address)
except Exception as e:
return []
request = '{\"id\":0,\"jsonrpc\":\"2.0\",\"method\":\"miner_getstat1\"}\n'
request = request.encode()
try:
sock.sendall(request)
except Exception as e:
return []
try:
data = sock.recv(512)
except Exception as e:
return []
message = json.loads(data)
sock.close()
return message
def get_data_claymore(miner_ip, miner_port):
hashrate_total = []
hashrate = []
accepted_shares = []
invalid_shares = []
miner_uptime = []
data = get_data(miner_ip, miner_port)
try:
all = data['result'][6].split(';')
gpu_temp = all[::2]
gpu_fans = all[1::2]
hashrate_total = int(data['result'][2].split(';')[0])
hashrate = data['result'][3].split(';')
accepted_shares = int(data['result'][2].split(';')[1])
invalid_shares = int(data['result'][2].split(';')[2])
miner_uptime = data['result'][1]
return gpu_temp, gpu_fans, hashrate_total, hashrate, accepted_shares, invalid_shares, miner_uptime
except Exception as e:
return []
data = get_data_claymore("192.168.1.13", 3333)
print(data)
Enjoy my friend!