从域名返回IPv6地址Python [英] Return IPv6 address Python from domain name

查看:1083
本文介绍了从域名返回IPv6地址Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在互联网上搜了一下,发现socket类可以从python中的域名返回IPv4地址。 共享主机上的域名IP地址说如何处理。

So I searched a little on the Internet and I found that the socket class can return the IPv4 address from the domain name in python. IP address of domain on shared host says how to do it.

我可以做同样的事情,但是返回IPv6地址?看来,在Python中支持IPv6是有限的,我发现没有资源在互联网上搜索。

Can I do exactly the same thing but return IPv6 address? It looks like support for IPv6 in Python is a bit limited and I found no resources searching on the Internet.

推荐答案

看看这里,我想这是你正在寻找的。

Take a look here, I think this is what you are looking for.

socket.getaddrinfo("example.com", None, socket.AF_INET6)

这篇关于从域名返回IPv6地址Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆