python模拟登录v2ex,python模拟v2ex,# coding=utf
文章由Byrx.net分享于2019-03-23 04:03:29
python模拟登录v2ex,python模拟v2ex,# coding=utf
# coding=utf-8 import requests from bs4 import BeautifulSoup as bs s = requests.Session() headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64)\ AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36', 'Origin': 'http://www.v2ex.com', 'Referer': 'http://www.v2ex.com/signin', 'Host': 'www.v2ex.com', } r = s.get('http://www.v2ex.com/signin', headers=headers) soup = bs(r.content) once = soup.find('input', {'name': 'once'})['value'] login_data = {'u': 'sijianwudi', 'p': '111111', 'once': once, 'next': '/'} s.post('http://www.v2ex.com/signin', login_data, headers=headers) f = s.get('http://www.v2ex.com/settings', headers=headers) soup = bs(f.content) print soup.find('input', {'type':'email'})['value']
相关内容
- Python抓妹子图+多进程,python抓妹子图,# -*- coding
- Python抓妹子图+多进程,python抓妹子图,# -*- coding
- python线程池进一步认识,python线程池认识,线程池的概念
- python代码实例大小写转换,首字母大写,去除特殊字符,
- python操作mysql数据库代码,pythonmysql数据库,python操作m
- pygame simulate,pygame,import pygam
- python 调用windows api查看系统的电量,pythonapi,通过调用
- 取一列数中连续最长的奇数个数,列数最长奇数个数
- Python实现 深度优先算法生成迷宫,python迷宫, import
- Python sql server和postgresql的表结构转换,pythonpostgresql,#
评论关闭