socket.getfqdn() works fine with IPv4 addresses, for example:
>>> import socket
>>> socket.getfqdn("8.8.8.8")
'google-public-dns-a.google.com'
However, it doesn’t work for IPv6 addresses.
>>> socket.getfqdn("2404:6800:8004::68")
'2404:6800:8004::68'
>>> socket.has_ipv6
True
How can I do this with IPv6? Ideally with only modules in the standard library.
Are you sure that ipv6 address has any revers DNS associated with it?
digreports it doesn’t:edit: Finally found an ipv6 address that has reverse DNS associated. In short, works4me.
And from dig: