mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-03-11 16:35:14 +00:00
Update server.py
This commit is contained in:
parent
4e2aeb0fa7
commit
dc0653de09
|
@ -93,14 +93,16 @@ def start(): #Main Program
|
||||||
print("\n[*] Graceful Shutdown")
|
print("\n[*] Graceful Shutdown")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def jsonrpc2_create_id(data):
|
||||||
|
return hashlib.sha1(json.dumps(data).encoding(client_encoding)).hexdigest()
|
||||||
|
|
||||||
def jsonrpc2_encode(method, params):
|
def jsonrpc2_encode(method, params):
|
||||||
data = {
|
data = {
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"method": method,
|
"method": method,
|
||||||
"params": params
|
"params": params
|
||||||
}
|
}
|
||||||
id = "0x%s" % (hashlib.sha1(json.dumps(data).encoding(client_encoding)).hexdigest())
|
data['id'] = jsonrpc2_create_id(data)
|
||||||
data['id'] = id
|
|
||||||
return json.dumps(data)
|
return json.dumps(data)
|
||||||
|
|
||||||
def parse_first_data(data):
|
def parse_first_data(data):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user