tychxn/jd-assistant

exception: 'NoneType' object has no attribute 'get'

DustinDuck opened this issue · 1 comments

正在抢一个目前没有货的sku,请问这样的输出是开始监听了吗?

2021-06-29 18:17:31,345 ERROR: 查询 *** 库存信息发生异常, resp: jQuery4648988({"StockState":33,"area":{"townName":"","provinceName":"北京","cityName":"朝阳区","success":true,"countyName":"三环以内"},"realSkuId":***,"choseSuit":[],"code":1,"err":true,"PopType":0,"ArrivalDate":null,"IsPurchase":false,"StockStateName":"有货","rn":-1}), exception: 'NoneType' object has no attribute 'get'

已解决。
改了一下数据格式:

            stock_info = resp_json.get('stock')
            sku_state = resp_json.get('code')  # 商品是否上架
            stock_state = resp_json.get('StockState')