username = ""
password = ""
s = requests.session()
url_login = "
http://m.51job.com/my/login.php"
url_login_post = "
http://m.51job.com/ajax/my/login.ajax.php"
url_refresh = "
http://m.51job.com/ajax/resume/refreshresume.ajax.php"
resume_id = ""
uagent = "Mozilla/5.0 (Linux; Android 4.0.4; \
Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) \
Chrome/18.0.1025.133 Mobile Safari/535.19"
headers = {
"user-agent": uagent,
}
rsp1 = s.get(url_login)
params_login = {
"username": username,
"password": password,
"verifycode": "",
"autologin": "0"
}
rsp2 =
s.post(url_login_post, headers=headers, data=params_login)
rsp2.encoding = 'utf-8'
jsn = json.loads(rsp2.text)
if not jsn['status'] == "1":
raise LoginError("51job login error")
EC2 上跑的话直接 Timeout,之前抓异地登陆的结果是能正常返回 Json, 里面 status 为 1,
requests.exceptions.Timeout: (<urllib3.connectionpool.HTTPConnectionPool object at 0x7ff0bbddba90>, 'Connection to
m.51job.com timed out. (connect timeout=9.2)')