This example shows how a dealer via Python connects to our XML-RPC server, creates a hosting account and registers a domain name.
Note that the following code example contains no error handling for the sake of readability.
Below you find the code for the example above.
#!/usr/local/bin/python # -*- coding: utf-8 -*- import calendar import sys import time import xmlrpclib def main(): global_username = 'YOUR_USERNAME' global_password = 'YOUR_PASSWORD' global_domain_server_url = \ 'https://api.loopia.se/RPCSERV' domain = 'anders-via-python-%s.se' % \ calendar.timegm(time.gmtime()) contact = {'firstname' : 'Anders', 'lastname' : 'Andersson', 'company' : 'Loopia AB', 'street' : 'Kopparlundsvägen 7B', 'street2' : '', 'zip' : '72130', 'city' : 'Västerås', 'country_iso2' : 'se', 'orgno' : '556633-9304', 'phone' : '021-128222', 'cell' : '', 'fax' : '', 'email' : 'info@loopia.se'} client = xmlrpclib.ServerProxy(uri = global_domain_server_url, encoding = 'utf-8') response = client.createNewAccount(global_username, global_password, domain, contact, False, False, True, 'HOSTING_UNIX', 'HOSTING_BUSINESS', True) print 'Account created: %s\n' % response if __name__ == '__main__': main()
Copyright Loopia AB 1999 - 2024
Loopia is part of team.blue
Loopia AB, Kopparbergsvägen 8, 722 13 Västerås
Org.nr: 556633-9304
Loopia’s services run on renewable energy