Created
September 22, 2021 15:37
-
-
Save AllanChain/842f02f59d5cd76f562925b15bc523bc to your computer and use it in GitHub Desktop.
Update a dynv6 ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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