Batting practice is not a programmer just to share a train of thought, some time ago batting practice inadvertently try to use Python to keep the manual landing site
Status, when landing on a forum, is to use the cookie value to identify the user identity, as long as the cookie value is not invalid, you can
Long-term landing status.
The idea of using Python to stay in the log state:
Manual Landing Forum
Get cookie value with Firefox grab package plugin Httofox
The value of the cookie transmitted by Python
The following is the Python implementation code
Import Urllib,urllib2
CJ = ' Acquired Cookie '
url = ' request page '
user = ' mozilla/5.0 (Windows; U Windows NT 6.1; ZH-CN; rv:1.9.2.13) gecko/20101203 firefox/3.6.13 '
Openr = Urllib2.build_opener (urllib2. Httpcookieprocessor ()) #创建打开器
Urllib2.install_opener (OPENR) #安装打开器
Self.openr.addheaders = [(' User-agent ', User),
(' Cookie ', CJ) #在请求头添加cookie
]
Self.con = Self.openr.open (Self.url). Read () #用打开器请求页面
Use this opener to request any page to remain logged in.
This article is from the "Old Buffalo Program" blog, make sure to keep this source http://itjishu.blog.51cto.com/2602918/1672795
The simple reality of how Python keeps the login state