def _start_repl(api):
# type: (Iota) -> None
"""
Starts the REPL.
"""
_banner = (
'IOTA API client for {uri} ({testnet}) initialized as variable `api`.\n'
'Type `help(api)` for list of API commands.'.format(
testnet = 'testnet' if api.testnet else 'mainnet',
uri = api.adapter.get_uri(),
)
)
try:
# noinspection PyUnresolvedReferences
import IPython
except ImportError:
# IPython not available; use regular Python REPL.
from code import InteractiveConsole
InteractiveConsole(locals={'api': api}).interact(_banner)
else:
# Launch IPython REPL.
IPython.embed(header=_banner)
评论列表
文章目录