美文网首页
requests.get常用参数

requests.get常用参数

作者: 有苦向瓜诉说 | 来源:发表于2017-04-23 20:20 被阅读473次
    headers  = {
        'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36',
        'Connection':'keep-alive'
    }
    
    # http://cn-proxy.com/
    proxy_list = [
        'http://117.177.250.151:8081',
        'http://111.85.219.250:3129',
        'http://122.70.183.138:8118',
        ]
    proxy_ip = random.choice(proxy_list) # 随机获取代理ip
    proxies = {'http': proxy_ip}
    
    
    
     wb_data = requests.get(list_view,headers=headers,proxies=proxies)
    

    相关文章

      网友评论

          本文标题:requests.get常用参数

          本文链接:https://www.haomeiwen.com/subject/gbiyzttx.html