我怎样才能从 python 程序而不是代理中找到我面向公众的 ip

use*_*r22 1 python linux centos ip-address python-2.7

我想从 python 程序中找到我的公共 IP 地址。

到目前为止,这是唯一的网站

http://www.whatismyip.com/http://whatismyip.org/

这给没有代理休息的ip都给了代理。

现在 .org 站点正在使用图像,第一个站点在许多跨度元素中写入 ip,因此我无法使用 urllib 进行抓取。

任何其他想法或网站,以便我可以获得我的 ip

Ble*_*der 5

我通常使用http://httpbin.org/

import requests

ip = requests.get('http://httpbin.org/ip').json()['origin']
Run Code Online (Sandbox Code Playgroud)