24 lines
578 B
Python
24 lines
578 B
Python
#!/usr/bin/python
|
|
|
|
import sys
|
|
import os
|
|
import xmlrpclib
|
|
import json
|
|
|
|
api_user=os.getenv('BITMESSAGE_API_USER', 'bitmessage_api_user') ;
|
|
api_password=os.getenv('BITMESSAGE_API_PASSWORD', 'bitmessage_api_password') ;
|
|
api_port=os.getenv('BITMESSAGE_API_PORT', '8442') ;
|
|
|
|
api_link="http://{}:{}@127.0.0.1:{}/".format(api_user, api_password, api_port)
|
|
|
|
api = xmlrpclib.ServerProxy(api_link)
|
|
|
|
network_connections=json.loads(api.clientStatus())['networkConnections']
|
|
print "networkConnections:", network_connections
|
|
|
|
if network_connections > 0:
|
|
sys.exit(0)
|
|
else:
|
|
sys.exit(1)
|
|
|