码迷,mamicode.com
首页 > 编程语言 > 详细

Python3 requests模块实现模仿浏览器+代理访问

时间:2020-06-12 14:20:55      阅读:90      评论:0      收藏:0      [点我收藏+]

标签:window   nbsp   app   mic   color   image   http   windows   col   

 

 

 

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模块实现模仿浏览器+代理访问

标签:window   nbsp   app   mic   color   image   http   windows   col   

原文地址:https://www.cnblogs.com/laod/p/13098730.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!