Skip to content

Instantly share code, notes, and snippets.

@AllanChain
Created September 22, 2021 15:37
Show Gist options
  • Save AllanChain/842f02f59d5cd76f562925b15bc523bc to your computer and use it in GitHub Desktop.
Save AllanChain/842f02f59d5cd76f562925b15bc523bc to your computer and use it in GitHub Desktop.
Update a dynv6 ip
import socket
import urllib.request
def get_out_ipv6():
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
s.connect(("2620:0:ccc::2", 80))
ipv6 = s.getsockname()[0]
s.close()
print(ipv6)
return ipv6
with urllib.request.urlopen(
f'https://dynv6.com/api/update?ipv6={get_out_ipv6()}&token=<token>&zone=<zone>'
) as url:
input(url.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment