Created
May 11, 2016 02:52
-
-
Save FGFW/96b23a86b284d6a5cdd6ccbbbada0d3a to your computer and use it in GitHub Desktop.
python3使用requests登录人人影视网站.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| python3使用requests登录人人影视网站.py | |
| 2016年5月11日 07:33:59 codegay | |
| 参考资料requests文档: | |
| http://cn.python-requests.org/zh_CN/latest/ | |
| 四种常见的 POST 提交数据方式 | |
| https://imququ.com/post/four-ways-to-post-data-in-http.html | |
| """ | |
| import re | |
| import requests | |
| #requests 安装命令:pip install requests | |
| loginurl='http://www.zimuzu.tv/User/Login/ajaxLogin' | |
| surl='http://www.zimuzu.tv/user/sign' | |
| httphead={ | |
| 'Accept':'application/json, text/javascript, */*; q=0.01', | |
| 'Origin':'http://www.zimuzu.tv', | |
| 'X-Requested-With':'XMLHttpRequest', | |
| 'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36', | |
| 'Content-Type': 'application/x-www-form-urlencoded', | |
| } | |
| data="account=用户名&password=密码&remember=1" | |
| session=requests.Session() | |
| login=session.post(loginurl,data=data,headers=httphead) | |
| print(login.cookies)#打印登录后取得到cookies对象 | |
| print(login.json()) | |
| getstat=session.get(surl).text.split("\n") #访问签到页面,显示最近三次登录时间 | |
| [print(r) for r in getstat if "三次登录时间" in r] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment