-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonrpc.py
More file actions
47 lines (39 loc) · 1.73 KB
/
jsonrpc.py
File metadata and controls
47 lines (39 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# !/usr/bin/env python
# coding=utf-8
import json
import os
def jsonrpc(http, http_port, ws, ws_port, path):
"""genrate jsonrpc config file"""
profile_config = dict(enable = False, flag_prof_start = 0, flag_prof_duration = 0)
http_config = dict(enable = http, thread_number = 200,
listen_ip = "0.0.0.0", listen_port = http_port,
timeout = 3)
ws_config = dict(
enable = ws, thread_number = 2,
listen_ip = "0.0.0.0", listen_port = ws_port,
max_connections = 800, queue_size = 200,
panic_on_new_connection = False, panic_on_shutdown = False,
fragments_capacity = 100, fragments_grow = True,
fragment_size = 65535, in_buffer_capacity = 2048,
in_buffer_grow = True, out_buffer_capacity = 2048,
out_buffer_grow = True, panic_on_internal = True,
panic_on_capacity = False, panic_on_protocol = False,
panic_on_encoding = False, panic_on_queue = False,
panic_on_io = False, panic_on_timeout = False,
shutdown_on_interrupt = True, masking_strict = False,
key_strict = False, method_strict = False,
encrypt_server = False, tcp_nodelay = False
)
data = dict()
data["with_capacity"] = 1000
data["profile_config"] = profile_config
data["http_config"] = http_config
data["ws_config"] = ws_config
data["new_tx_flow_config"] = dict(count_per_batch = 30, buffer_duration = 30000000)
dump_path = os.path.join(path, "jsonrpc_result.json")
f = open(dump_path, "w")
json.dump(data, f, indent = 4)
f.close()
if __name__ == '__main__':
jsonrpc(http='www.baidu.com',http_port='8080',ws='shop.dianjia.io',ws_port='8888',path='')
print(os.path.isfile('jsonrpc.json'))