如何验证代理有效

如何验证代理有效

  在百度输入IP,百度即会显示他所认为的你的IP。当不使用代理时,显示的即为你的真实IP,当使用高匿代理时,显示的即为代理IP。

  下图为不使用代理时的情形:

  

  用BeautifulSoup写了一个简易的使用了代理的web浏览器。

  gh = Ghost()
    se = Session(gh, display=True)
    se.set_proxy("https", aIP, aPort)
    se.open("https://www.baidu.com/")
    se.show()
    se.sleep(10)

  为一个代理程序使用代理时的情形:

  

  

  

原文地址:https://www.cnblogs.com/tekkaman/p/5589513.html