求教使用Tornado的HTTPClient登录HDOJ...怎么都登录不了不知道什么问题,httpclienthdoj..,request = to
求教使用Tornado的HTTPClient登录HDOJ...怎么都登录不了不知道什么问题,httpclienthdoj..,request = to
request = tornado.httpclient.HTTPRequest("http://acm.hdu.edu.cn/userloginex.php?action=login")request.method = 'POST'request.user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"request.headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Cache-Control": "max-age=0", "Connection": "keep-alive", "Content-Length": "44", "Content-Type": "application/x-www-form-urlencoded", "Host": "acm.hdu.edu.cn", "Origin": "http://acm.hdu.edu.cn", "Referer": "http://acm.hdu.edu.cn/",}request.body = "username=****&userpass=****&login=Sign+In"client = tornado.httpclient.HTTPClient()response = client.fetch(request)
就这样的方式,怎么都登录不了,可是POJ却能够成功登录,请问有什么问题?
response的内容
HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x7fb1a06a49a8>,code=200,effective_url='http://acm.hdu.edu.cn/userloginex.php?action=login',error=None,headers={'Set-Cookie': 'PHPSESSID=sm6dbdatftbmh0u4jg96r1h5u3; path=/', 'Cache-Control': 'no-cache, must-revalidate', 'Last-Modified': 'Sat, 16 May 2015 09:01:41 GMT', 'X-Cache': 'MISS from wwwcache2.hdu.edu.cn', 'Expires': 'Mon, 14 Feb 1983 10:10:00 GMT', 'Server': 'Apache', 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'Date': 'Sat, 16 May 2015 09:01:41 GMT', 'P3p': 'CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR', 'Vary': 'Accept-Encoding', 'Content-Length': '2947', 'X-Consumed-Content-Encoding': 'gzip', 'Content-Type': 'text/html', 'X-Powered-By': 'PHP/5.3.29', 'Via': '1.1 wwwcache2.hdu.edu.cn (squid/3.4.13)'},reason='OK',request=<tornado.httpclient.HTTPRequest object at 0x7fb1a4859240>,request_time=0.3185768127441406,time_info={})
response的body里面是登录页面,登录页面中显示并没有登录成功
编橙之家文章,
相关内容
- 运行scrapy报错:The 'six>=1.5.2' distribution was not found,
- 只用python、html和js能实现一个随手机摇动改变页面颜色
- python 字典cmp()函数问题,pythoncmp,dict1 = {'Na
- 如何用chrome自带的抓包工具分析向一个网站提交的数据
- Django static=False时,静态文件的处理。,djangostatic,请问
- 如何解决apscheduler定时任务自动重启,导致定点执行的
- Django不认为是文件,而Python认为是文件?,,一个view:
- try-finally中的1个坑,try-finally,在编写高质量代码-改善
- 源码中闭包的问题,求大神解救。。,源码大神,我在看
- Python IDE有没有类似其他IDE的智能提示?,pythonide,很多
评论关闭