""" Automatically add Google MX records to a domain using Slicehost DNS. Requires:: PyActiveResource: http://superjared.com/projects/pyactiveresource/ Edit the zone_id below, add your api password and run. To find your zone_id, go to the DNS tab of the SliceManager, click the 'edit' next to your domain. The URL will have the id:: https://manage.slicehost.com/zones//edit """ from pyactiveresource import ActiveResource import sys zone_id = 1 api_password = 'your api password' api_site = 'https://%s@api.slicehost.com/' % api_password class Zone(ActiveResource): class Meta: site = api_site class Record(ActiveResource): class Meta: site = api_site data = ( ('ASPMX.L.GOOGLE.COM.', 10), ('ALT1.ASPMX.L.GOOGLE.COM.', 20), ('ALT2.ASPMX.L.GOOGLE.COM.', 20), ('ASPMX2.GOOGLEMAIL.COM.', 30), ('ASPMX3.GOOGLEMAIL.COM.', 30), ('ASPMX4.GOOGLEMAIL.COM.', 30), ('ASPMX5.GOOGLEMAIL.COM.', 30), ) def main(): z = Zone.find(id=zone_id)[0] for d in data: r = Record(data=d[0], record_type='MX', aux=d[1], zone_id=z.id, name=z.origin) print r.save() if __name__ == '__main__': main()