1. 程式人生 > >爬中國聯通

爬中國聯通

wow64 ssi name safari () passwd res member turn

#coding=utf8
import requests
class ChinaUnicom(object):

    headerx={User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36}
    login_url=https://uac.10010.com/portal/Service/MallLogin
    info_url=https://uac.10010.com/cust/infomgr/anonymousInfoAJAX
def __init__(self,phone,server_passwd): self.ss=requests.session() self.phone=phone self.server_passwd=server_passwd def login(self): datax={ callback:jQuery17208315958887266249_1502520335284, req_time:1502520347528, redirectURL
:http://www.10010.com, userName:self.phone, password:self.server_passwd, pwdType:01, productType:01, redirectType:01, rememberMe:1, _:1502520347531, } self.ss.get(self.login_url,params=datax,headers=self.headerx) #
#可以不要真實瀏覽器ua def get_infomgrInit(self): ‘‘‘獲取個人信息‘‘‘ resp=self.ss.post(self.info_url) return resp.content if __name__=="__main__": cu=ChinaUnicom(1314880xxxx,37xxxx) cu.login() print cu.get_infomgrInit()

先登錄再爬取。

技術分享

爬中國聯通