标签:httpd python3 out time env http host def python
近期业务APP域名被运营商劫持日益严重,已经开始和开发商议使用httpdns事宜;我自己先测试了一下免费的接口还是挺好用分享一下:核心就是requests取域名
python环境是python3.6
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
def getip():
hostinput = input(‘Please input the url:‘)
hufur=requests.get("http://119.29.29.29/d",params={‘dn‘: requests.urllib3.get_host(hostinput)[1]},timeout=0.1)
print("The real IP: %s" % (hufur.content.decode(‘utf-8‘)))
getip()
标签:httpd python3 out time env http host def python
原文地址:http://blog.51cto.com/yjw1983/2065036