python登陆网页并处理网站s es s ion和c ookie这是一个python通过urllib直接登陆网站并处理网站的session和c ookieimport cookielib,urllib,urllib2login=‘ismellbacon123@yahoo.com’password=‘login’
#Enable cookie support for urllib2cookiejar=cookielib.CookieJar()urlOpener=urllib2.build_open er(urllib2.HTTPCookieProc es sor(c ookiejar))#Send login/password to the site and get the session cookievalues={‘login’ :login, ‘password’ :pas sword}data=urllib.ur lenc ode(values)reques t=urllib2.Reques t(http://www.imdb.c om/regis ter/login,data)url=urlOpener.open(request)#Our cookiejar automatically receives the cookiesp ag e=url.r e ad(500000)
#Make sure we are logged in by checking the presence of the cookie id.#(which is the c ookie containing the s es sion identifier.)if not ‘id’ in[cookie.name for cookie in cookiejar] :raise ValueError,Login failed with login=%s,password=%s%(login,password)print We are logged in!
#Make another request with our session cookie
#(Our urlOpener automatically uses cookies from our cookiejar)url=urlOpener.open(‘http://imdb.c om/find?s=all q=grave’)
p ag e=url.r e ad(200000)
Hostigger 主机商在前面的文章中也有介绍过几次,这个商家运营时间是有一些年份,只不过在我们圈内好像之前出现的次数不多。最近这段时间商家有提供不限流量的VPS主机,逐渐的慢慢被人认识到。在前面的介绍到他们提供的机房还是比较多的,比如土耳其、美国等。今天看到Hostigger 商家居然改动挺大的,原来蛮好的域名居然这次连带官方域名都更换掉去掉一个G(Hostiger )。估摸着这个域名也是之前...
BuyVM测评,BuyVM怎么样?BuyVM好不好?BuyVM,2010年成立的国外老牌稳定商家,Frantech Solutions旗下,主要提供基于KVM的VPS服务器,数据中心有拉斯维加斯、纽约、卢森堡,付费可选强大的DDOS防护(月付3美金),特色是1Gbps不限流量,稳定商家,而且卢森堡不限版权。1G或以上内存可以安装Windows 2012 64bit,无需任何费用,所有型号包括免费的...
DMIT,最近动作频繁,前几天刚刚上架了日本lite版VPS,正在酝酿上线日本高级网络VPS,又差不多在同一时间推出了美国cn2 gia线路不限流量的美国云服务器,不过价格太过昂贵。丐版只有30M带宽,月付179.99 美元 !!目前美国云服务器已经有个4个套餐,分别是,Premium(cn2 gia线路)、Lite(普通直连)、Premium Secure(带高防的cn2 gia线路),Prem...