Created
March 24, 2019 09:42
-
-
Save brenzi/3f289376289ab0efe81f7309429f09e2 to your computer and use it in GitHub Desktop.
python substrate RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
#url = "https://substrate-rpc.parity.io/" | |
url = "http://127.0.0.1:9944/" | |
headers = {'content-type': 'application/json'} | |
payload = { | |
"method": "chain_getRuntimeVersion", | |
"params": None, | |
"jsonrpc": "2.0", | |
"id": 0, | |
} | |
response = requests.post(url, data=json.dumps(payload), headers=headers) | |
# results in http 400 | |
# substrate log says: | |
# 2019-03-24 10:40:46 Accepted a new tcp connection from 127.0.0.1:43476. | |
# 2019-03-24 10:40:46 WS Error <Protocol>: Unable to parse WebSocket key. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment