Skip to content

Commit c30cf11

Browse files
committed
Add OpenRPC compatibility
1 parent 00b24a9 commit c30cf11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jsonrpc/jsonrpc2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class JSONRPC20Request(JSONRPCBaseRequest):
4545
JSONRPC_VERSION = "2.0"
4646
REQUIRED_FIELDS = set(["jsonrpc", "method"])
4747
POSSIBLE_FIELDS = set(["jsonrpc", "method", "params", "id"])
48+
CUSTOM_RPC_INTERNALS = set(["rpc.discover"])
4849

4950
@property
5051
def data(self):
@@ -71,7 +72,7 @@ def method(self, value):
7172
if not isinstance(value, six.string_types):
7273
raise ValueError("Method should be string")
7374

74-
if value.startswith("rpc."):
75+
if value.startswith("rpc.") and value not in self.CUSTOM_RPC_INTERNALS:
7576
raise ValueError(
7677
"Method names that begin with the word rpc followed by a " +
7778
"period character (U+002E or ASCII 46) are reserved for " +

0 commit comments

Comments
 (0)