2016-11-18 99 views
0

需要有关adidas auto checkout脚本的帮助。收到以下错误:adidas脚本:'NoneType'对象不可自订

Traceback (most recent call last): 

File "adidas.py", line 169, in <module> 
    checkout() 
File "adidas.py", line 80, in checkout 
    url = soup.find('div', {'class': 'cart_wrapper rbk_shadow_angle rbk_wrapper_checkout summary_wrapper'})['data-url'] 
TypeError: 'NoneType' object is not subscriptable 

链接到整个脚本:https://github.com/kfichter/OpenATC/blob/482360a7a160136a4969d2cf0527809660d021fb/Scripts/adidas.py

回答

0

soup.find()将返回None。您试图在此结果中查找密钥'data-url',但None不支持密钥查找。

根据您要做的事情,您应该更改查询,使其不返回None,或者在尝试访问'data-url'密钥之前检查该值不是None

相关问题