Created
September 7, 2012 15:25
-
-
Save syshack/3667153 to your computer and use it in GitHub Desktop.
login
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
| #!/usr/bin/python | |
| import urllib2 | |
| import cookielib | |
| #登录URL | |
| login_url = 'http://www.buildhr.com/enterprise/login.php' | |
| #cookie处理器 | |
| cookies = urllib2.HTTPCookieProcessor() | |
| opener = urllib2.build_opener(cookies) | |
| urllib2.install_opener(opener) | |
| #构造header | |
| headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.60 Safari/537.1', | |
| 'Referer' : 'http://www.buildhr.com/enterprise/login.php'} | |
| postData = {'act' : 'login', | |
| 'ajax' : '0', | |
| 'clear':'0', | |
| 'uid' : 'fqyea', | |
| 'pwd' : 'hhr1e1055', | |
| 'to_url' : 'http://www.buildhr.com/enterprise/service/', | |
| 'op' : '20030107,Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.60 Safari/537.1' | |
| } | |
| #Post数据编码 | |
| postData = urllib.urlencode(postData) | |
| #登录 | |
| request = urllib2.Request(login_url, postData, headers) | |
| response = urllib2.urlopen(request) | |
| #获取数据 | |
| cv=urllib2.urlopen('http://www.buildhr.com/enterprise/resume/resume_searcher_preview.php?info=12210411878458&q=') | |
| print cv.read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment