401脚本的客户端错误

时间:2018-01-18 15:58:25

标签: javascript python

我在为Nike.com运行此脚本时遇到问题。

prox=random.choice(PROXYLIST)
nam=name.split(' ')
sess=requests.session()
sess.cookies["CONSUMERCHOICE"]="cn/zh_cn"
sess.cookies["NIKE_COMMERCE_COUNTRY"]="CN"
sess.cookies["NIKE_COMMERCE_LANG_LOCALE"]="zh_CN"
sess.cookies["nike_locale"]="cn/zh_cn"
sess.headers.update({"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"})
dob=str(random.randint(1990,1995))+"-"+str(random.randint(10,12))+"-"+str(random.randint(10,28))
print "Using number: {0}\n".format(NUMBER),
if country=="US":
    payload={"account":{"email":email,"passwordSettings":{"password":password,"passwordConfirm":password}},"locale":"en_US","welcomeEmailTemplate":"TSD_PROF_COMM_WELCOME_V1.0","registrationSiteId":"nikedotcom","username":email,"lastName":nam[1],"firstName":nam[0],"dateOfBirth":dob,"country":"US","mobileNumber":NUMBER,"gender":"male","receiveEmail":True}
else:
    payload={"account":{"email":email,"passwordSettings":{"password":password,"passwordConfirm":password}},"locale":"en_GB","welcomeEmailTemplate":"TSD_PROF_COMM_WELCOME_V1.0","registrationSiteId":"nikedotcom","username":email,"lastName":nam[1],"firstName":nam[0],"dateOfBirth":dob,"country":"GB","mobileNumber":NUMBER,"gender":"male","receiveEmail":True}
getLock(prox)
print "Signing up with email {0}\n".format(email),
r=sess.post("https://unite.nike.com/join?appVersion={0}&experienceVersion={1}&uxid=com.nike.commerce.nikedotcom.web&locale=zh_CN&backendEnvironment=identity&browser=Google%20Inc.&os=undefined&mobile=false&native=false".format(APPVERSION,EXPVERSION),json=payload,verify=False,proxies={"https":prox})
r.raise_for_status()
getLock(prox)
e=sess.post("https://unite.nike.com/loginWithSetCookie?appVersion={0}&experienceVersion={1}&uxid=com.nike.commerce.nikedotcom.web&locale=zh_CN&backendEnvironment=identity&browser=Google%20Inc.&os=undefined&mobile=false&native=false".format(APPVERSION,EXPVERSION),json={"username":email,"password":password,"client_id":"HlHa2Cje3ctlaOqnxvgZXNaAs7T9nAuH","ux_id":"com.nike.commerce.nikedotcom.web","grant_type":"password"},verify=False,proxies={"https":prox})
e.raise_for_status()
TOKEN=json.loads(e.text)['access_token']
sess1=sess
sess=requests.session()
print "Logging in with email {0}\n".format(email),
if country=="US":
    sess.cookies["CONSUMERCHOICE"]="us/en_us"
    sess.cookies["NIKE_COMMERCE_COUNTRY"]="US"
    sess.cookies["NIKE_COMMERCE_LANG_LOCALE"]="en_US"
    sess.cookies["nike_locale"]="us/en_US"
    sess.headers.update({"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"})
    getLock(prox)
    e=sess.post("https://unite.nike

我将收到此错误,401客户端错误:未经授权的网址:https://unite.nike.com/loginWithSetCookie?appVersion=302&experienceVersion=267&uxid=com.nike.commerce.nikedotcom.web&locale=zh_CN&backendEnvironment=identity&browser=Google%20Inc.&os=undefined&mobile=false&native=false

我希望有人能帮助我。

0 个答案:

没有答案