Advertisement
Guest User

Untitled

a guest
Feb 11th, 2010
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import calendar
  5. import sys
  6. import time
  7. import xmlrpclib
  8. import socket
  9.  
  10. username = 'XXXX@loopiaapi'
  11. password = 'XXXX'
  12. domain = 'XXXX'
  13. subdomain = 'XXXX'
  14.  
  15. s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
  16. s.connect(('ipv6.google.com', 0))
  17. IP6 = s.getsockname()[0]
  18.  
  19. global_domain_server_url = 'https://api.loopia.se/RPCSERV'
  20. client = xmlrpclib.ServerProxy(uri = global_domain_server_url, encoding = 'utf-8')
  21.  
  22. myrecords = client.getZoneRecords(username, password, domain, subdomain)
  23. for myrecord in myrecords:
  24. if myrecord['type'] == 'AAAA' and myrecord['rdata'] != IP6:
  25. myrecord['rdata'] = IP6
  26. client.updateZoneRecord(username, password, domain, subdomain, myrecord)
  27. print myrecord
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement