From Python-I2P.
i2p.router
allows Python programs to control the I2P router.
check(dir=None)
Checks whether a locally installed router is running. Does nothing if successful, otherwise raises i2p.RouterError. An I2P installation is located by using find(dir). The router.config file is parsed for 'router.adminPort'. This port is queried to determine whether the router is running.find(dir=None)
Find the absolute path to a locally installed I2P router. An I2P installation is located by looking in the environment I2P, then in PATH, then in the dir argument given to the function. It looks for startRouter.sh or startRouter.bat. Raises ValueError if an I2P installation could not be located.start(dir=None, hidden=False)
Start a locally installed I2P router. Does nothing if the router has already been started. An I2P installation is located by using find(dir). If hidden is True, do not show a terminal for the router.stop(dir=None, force=False)
Stop a locally installed I2P router, if it was started by the current Python program. If force is True, stop the router even if it was started by another process. Do nothing if force is False and the router was started by another program. The file 'router.config' is located using the same search process used for find(dir). It is parsed for 'router.shutdownPassword' and 'router.adminPort'. The router is shut down through the admin port. Raises i2p.RouterError if the I2P router is running but cannot be stopped. You must uncomment the 'router.shutdownPassword' line for this command to work.