pyircbot/pyircbot/rpcclient.py

17 lines
518 B
Python
Raw Normal View History

2017-01-01 14:59:01 -08:00
from sys import argv, exit
2015-07-18 21:11:00 -07:00
from pyircbot import jsonrpc
2017-01-01 14:59:01 -08:00
2015-07-18 21:11:00 -07:00
def connect(host, port):
return jsonrpc.ServerProxy(jsonrpc.JsonRpc20(), jsonrpc.TransportTcpIp(addr=(host, port), timeout=60.0))
2017-01-01 14:59:01 -08:00
if __name__ == "__main__":
2015-07-18 21:11:00 -07:00
if len(argv) is not 3:
print("Expected ip and port arguments")
exit(1)
2017-01-01 14:59:01 -08:00
print("Connecting to pyircbot rpc on port %s:%s..." % (argv[1], argv[2]))
2015-07-18 21:11:00 -07:00
rpc = connect(argv[1], int(argv[2]))
print("Connected to rpc")
print("Loaded modules: %s" % rpc.getLoadedModules())