-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnet.py
27 lines (19 loc) · 967 Bytes
/
net.py
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
from Base_API_Call import API
import http.client
import json
class net_Request:
def version(conn=http.client.HTTPSConnection("rpc.xinfin.network"), form="JSON"):
Call = "POST"
Content = "//version"
Payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}"
return API.Format(Call,Payload,Content,conn,form)
def listening(conn=http.client.HTTPSConnection("rpc.xinfin.network"), form="JSON"):
Call = "POST"
Content = "//listening"
Payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}"
return API.Format(Call,Payload,Content,conn,form)
def peerCount(conn=http.client.HTTPSConnection("rpc.xinfin.network"), form="JSON"):
Call = "POST"
Content = "//peerCount"
Payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}"
return API.Format(Call,Payload,Content,conn,form)