#coding=utf-8 import requests proxies={‘http‘:‘http://username:[email protected]:8080‘, ‘https‘:‘https:// username:password @proxyhk.huawei.com:8080‘} headers={ ‘Accept‘:‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8‘, ‘Accept-Encoding‘:‘gzip, deflate, sdch, br‘, ‘Accept-Language‘:‘zh-CN,zh;q=0.8‘, ‘Connection‘:‘keep-alive‘, ‘Cookie‘:‘d_c0="AEBA0ad7CgqPTpn46WqTLylJ5zM2niskLLk=|1465282196"; _za=f957aee3-cd90-404e-99e6-315688d1083d; _zap=3013a11b-5acb-494a-98b1-9d2d2173efe9; _xsrf=c0ff9c15162e370f1fe5059c65c4e539; l_n_c=1; q_c1=1d1c7cbd9ced49bea80d0e490df31444|1476932337000|1476932337000; cap_id="OTQ2ZGM4YTkzZDI0NDI2NmI5MGU3NjFlYmFlYmQxOTA=|1476932337|ebc073386a1879a86110950ea6cf32a906ffb519"; l_cap_id="ZTJkZTJlMmE1ZDJjNGI4ODllNzA2YTAyMDA2OTc1OTY=|1476932337|572ca9f84c799a9b3f1396d2c07cbf79fb945bca"; __utmt=1; login="YzhmMjBlOGM5YmMzNDU3MDk2YWJlMGMyMWNlYWY0MDI=|1476932379|3805699b14f193d19c4d53de2faaeb1fdbdc1cb1"; __utma=51854390.44980497.1476931660.1476931660.1476931660.1; __utmb=51854390.15.9.1476931957487; __utmc=51854390; __utmz=51854390.1476931518.5.5.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; __utmv=51854390.000--|2=registration_date=20150506=1^3=entry_date=20161020=1; a_t="2.0ABCAMcUJCggXAAAAnMAvWAAQgDHFCQoIAEBA0ad7CgoXAAAAYQJVTZzAL1gA4ER-QzAWMFULafVE8kVRccyyibC9rn2GsWG_RTDl7mYKEqYsyGIIBA=="; z_c0=Mi4wQUJDQU1jVUpDZ2dBUUVEUnAzc0tDaGNBQUFCaEFsVk5uTUF2V0FEZ1JINURNQll3VlF0cDlVVHlSVkZ4ekxLSnNB|1476932508|31c59a22174d393622e19bdafdb5ee9c9281e69c‘, ‘Host‘:‘www.zhihu.com‘, ‘Referer‘:‘https://www.zhihu.com/‘, ‘Upgrade-Insecure-Requests‘:‘1‘, ‘User-Agent‘:‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36‘ } #无脑登录,将登录后的cookies一并请求,一般应对cookies不变的情况 s=requests.session() req=s.get(‘https://www.zhihu.com/‘,proxies=proxies,headers=headers) print req.content
时间: 2024-10-11 05:22:10