Skip to content

Instantly share code, notes, and snippets.

@eviljim
Created July 9, 2013 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eviljim/5957495 to your computer and use it in GitHub Desktop.
Save eviljim/5957495 to your computer and use it in GitHub Desktop.
Basic python class to talk to an Interworx webhosting control panel (nodeworx or siteworx) API using python.
import xmlrpclib
class InterworxRpc(object):
def __init__(self, server_url, key_file):
with open(key_file, 'r') as f:
self.key = f.read()
self.server = xmlrpclib.Server('https://%s:2443/xmlrpc' % server_url)
def Query(self, path, cmd, params=None):
params = params or {}
return self.server.iworx.route(
self.key, path, cmd, params)
# The demo code below is just an example use of the above.
SERVER_URL = 'hazelgrace.amusive.com'
# You will need to create a file with this name that contains your API key.
# Make sure this file does not have read permissions granted to any other users!
KEY_FILE = '.interworx.key'
rpc = InterworxRpc(SERVER_URL, KEY_FILE)
# Issue a command to get a list of all zones for this server.
res = rpc.Query('/nodeworx/dns/zone', 'listZones')
for dom in res['payload']:
print dom['domain']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment