|
|
@ -10,12 +10,12 @@ |
|
|
|
'''Script to send RPC commands to a running ElectrumX server.''' |
|
|
|
|
|
|
|
|
|
|
|
from aiorpcx import timeout_after, Connector, RPCSession, TaskTimeout |
|
|
|
import argparse |
|
|
|
import asyncio |
|
|
|
import json |
|
|
|
from os import environ |
|
|
|
|
|
|
|
from aiorpcx import timeout_after, Connector, RPCSession |
|
|
|
import electrumx.lib.text as text |
|
|
|
|
|
|
|
|
|
|
@ -113,7 +113,7 @@ def main(): |
|
|
|
# aiorpcX makes this so easy... |
|
|
|
async def send_request(): |
|
|
|
try: |
|
|
|
async with timeout_after(15): |
|
|
|
async with timeout_after(30): |
|
|
|
async with Connector(RPCSession, 'localhost', port) as session: |
|
|
|
session.framer.max_size = 0 |
|
|
|
result = await session.send_request(method, args) |
|
|
@ -130,7 +130,7 @@ def main(): |
|
|
|
print('cannot connect - is ElectrumX catching up, not running, or ' |
|
|
|
f'is {port} the wrong RPC port?') |
|
|
|
except Exception as e: |
|
|
|
print(f'error making request: {e!r}') |
|
|
|
print(f'error making request: {e}') |
|
|
|
|
|
|
|
loop = asyncio.get_event_loop() |
|
|
|
loop.run_until_complete(send_request()) |
|
|
|