cookie_file = “/tmp/netcraft_cookie.txt”
global_cookie = cookielib.MozillaCookieJar(cookie_file)
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(global_cookie))
pq = PyQuery(opener.open(sso_url).read())
csrf_token = pq(“input[name=’csrf_token’]”).attr(“value”)
destination = pq(“input[name=’destination’]”).attr(“value”)
print “get page \n csrf_token : %s \n destination: %s ” % (csrf_token,destination)
global_cookie.save(ignore_discard=True, ignore_expires=True)
Maybe you like these: |
python 简单正则表达式 |
python 带有选项的程序 |
ubuntu下搭建j2me环境和j2me版本hello world |
Mac OS X10.9安装的Python2.7升级Python3.3步骤详解 |
一段多线程死锁代码 |
无觅 |