Primer prikazuje kako se distributer, koristeći Python, povezuje na naš XML-RPC server, kreira hosting nalog i registruje domen.
Imajte u vidu da, zbog jasnijeg prikaza, primer ne sadrži upravljanje greškama.
Ispod se nalazi kod za navedeni primer.
#!/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 d.o.o. 1999 - 2024
Loopia je deo team.blue
Loopia d.o.o. TPC Kalča C1/72,73 · Niš
Loopia servise pokreću obnovljivi izvori energije