1
omoyouo 2015-04-22 11:19:43 +08:00
怎么弄得,我也想搞个自动签到
|
2
rse43 2015-04-22 11:22:30 +08:00
看看521里的js吧,把cookie从js里提取出来设置进去就可以往下走了。 不过选个5xx的code来做bot防护还真是奇葩,怎么也应该是2xx或者3xx。
|
5
ca1n 2015-04-23 10:23:44 +08:00
看看正常请求和程序请求发的包吧
|
6
aru 2015-04-23 11:16:55 +08:00 1
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36'}
session = requests.session() session.headers=headers r = session.get('http://www.smzdm.com/') e = 'c.push\("(.*?)"\)' m = re.findall(e,r.content) c = ''.join(m) session.cookies['__jsl_clearance'] = c r = session.get('http://www.smzdm.com/') print r 接下来可以正常用原来的请求了 |
7
jianghu52 OP @aru 你跑是正常的么。我跑的话还是报错。
在session.get 那行就错了。 [ File "D:/Dropbox/python_file/read_text/test2_smzdm.py", line 31, in run2 r = session.get('http://www.smzdm.com/') File "C:\Python27\lib\site-packages\requests\sessions.py", line 477, in get return self.request('GET', url, **kwargs) File "C:\Python27\lib\site-packages\requests\sessions.py", line 465, in request resp = self.send(prep, **send_kwargs) File "C:\Python27\lib\site-packages\requests\sessions.py", line 573, in send r = adapter.send(request, **kwargs) File "C:\Python27\lib\site-packages\requests\adapters.py", line 415, in send raise ConnectionError(err, request=request) ] 是我导入的requests 包不对? |