- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- import calendar
- import sys
- import time
- import xmlrpclib
- import socket
- username = 'XXXX@loopiaapi'
- password = 'XXXX'
- domain = 'XXXX'
- subdomain = 'XXXX'
- s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
- s.connect(('ipv6.google.com', 0))
- IP6 = s.getsockname()[0]
- global_domain_server_url = 'https://api.loopia.se/RPCSERV'
- client = xmlrpclib.ServerProxy(uri = global_domain_server_url, encoding = 'utf-8')
- myrecords = client.getZoneRecords(username, password, domain, subdomain)
- for myrecord in myrecords:
- if myrecord['type'] == 'AAAA' and myrecord['rdata'] != IP6:
- myrecord['rdata'] = IP6
- client.updateZoneRecord(username, password, domain, subdomain, myrecord)
- print myrecord
SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.