Args: url (str): URL of the RPC server to call node_number (int): the node number (or id) that this calls to Kwargs: timeout (int): HTTP timeout in seconds Returns: AuthServiceProxy. convenience object for making RPC calls.
(url, node_number, timeout=None, coveragedir=None)
| 242 | n = None |
| 243 | |
| 244 | def get_rpc_proxy(url, node_number, timeout=None, coveragedir=None): |
| 245 | """ |
| 246 | Args: |
| 247 | url (str): URL of the RPC server to call |
| 248 | node_number (int): the node number (or id) that this calls to |
| 249 | |
| 250 | Kwargs: |
| 251 | timeout (int): HTTP timeout in seconds |
| 252 | |
| 253 | Returns: |
| 254 | AuthServiceProxy. convenience object for making RPC calls. |
| 255 | |
| 256 | """ |
| 257 | proxy_kwargs = {} |
| 258 | if timeout is not None: |
| 259 | proxy_kwargs['timeout'] = timeout |
| 260 | |
| 261 | proxy = AuthServiceProxy(url, **proxy_kwargs) |
| 262 | proxy.url = url # store URL on proxy for info |
| 263 | |
| 264 | coverage_logfile = coverage.get_filename( |
| 265 | coveragedir, node_number) if coveragedir else None |
| 266 | |
| 267 | return coverage.AuthServiceProxyWrapper(proxy, coverage_logfile) |
| 268 | |
| 269 | def p2p_port(n): |
| 270 | assert(n <= MAX_NODES) |