Python3 requests模块实现模仿浏览器+代理访问
Posted 阿久丶xin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python3 requests模块实现模仿浏览器+代理访问相关的知识,希望对你有一定的参考价值。
import requests def xiaodai(): url = \'http://erge1998.cn/\' proxies = { \'http\': \'http://149.28.38.64:1081\', \'https\': \'https://149.28.38.64:1081\' } headers = { \'User-agent\': \'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36\' } try: response = requests.get (url, headers=headers, proxies=proxies) print(response.text) except Exception as e: print(e) if __name__ == \'__main__\': xiaodai()
打印结果
以上是关于Python3 requests模块实现模仿浏览器+代理访问的主要内容,如果未能解决你的问题,请参考以下文章