This is what i am doing
RPC_USER = username
RPC_PASS = pasword
rpc_id =  ID HERE
jsonrpc = "2.0"
payload = {"jsonrpc": jsonrpc, "id": rpc_id, "method": method, "params": params}
authstr = base64.encodestring(bytes('%s:%s' % (RPC_USER, RPC_PASS), 'utf-8')).strip() 
request_headers = {"Authorization": "Basic %s" % authstr, 'content-type': 'application/json'}
try:
    response = requests.get(RPC_URL, headers = request_headers, data = json.dumps(payload)).json()
    print(response['result'])      
except Exception as e: print(str(e))
if response['id'] != rpc_id:
        raise ValueError("invalid response id!")
I get this error:
I've been trying for hours, and I just don't know what I'm doing wrongly. It's just for planning/research (not performant) -- playing around with some code from github -- but I need to see it functional.
RPC_USER = username
RPC_PASS = pasword
rpc_id =  ID HERE
jsonrpc = "2.0"
payload = {"jsonrpc": jsonrpc, "id": rpc_id, "method": method, "params": params}
authstr = base64.encodestring(bytes('%s:%s' % (RPC_USER, RPC_PASS), 'utf-8')).strip() 
request_headers = {"Authorization": "Basic %s" % authstr, 'content-type': 'application/json'}
try:
    response = requests.get(RPC_URL, headers = request_headers, data = json.dumps(payload)).json()
    print(response['result'])      
except Exception as e: print(str(e))
if response['id'] != rpc_id:
        raise ValueError("invalid response id!")
I get an error as follows:
Here's the whole traceback:
Expecting value: line 1 column 1 (char 0) # prints the Exception
Traceback (most recent call last): 
  File "miner_2017.py", line 411, in <module>
    solo_miner(bin2hex("------coinbase message here -----"), "-----bitcoin address here-----")
  ---
----
---
UnboundLocalError: local variable 'response' referenced before assignment