DailyCP
DailyCP copied to clipboard
getCollectorDetail方法中获取的ret有问题
报错log:
PS C:\Other\SoftWare\MySoftWare\DailyCP-master> python3 DailyCP.py xxx xxxx xxxx xxxx Login succeeded. [{'wid': '21391', 'instanceWid': 8883, 'formWid': '9028', 'priority': '5', 'subject': '2022级新生来校报到健康打卡', 'content': 'https://wecres.cpdaily.com/counselor/1020258402117903/html/9c42c5107a064797b6f28b06105a635e.html', 'senderUserName': '赵亚宾(材料与冶金学院)', 'createTime': '2022-09-08 00:21', 'startTime': '2022-09-08 00:01', 'endTime': '2022-09-08 23:59', 'currentTime': '2022-09-08 13:41:56', 'isHandled': 0, 'isRead': 0}] {"code":"2210060000","message":"循环普通任务实例wid为空","datas":null} Traceback (most recent call last): File "C:\Other\SoftWare\MySoftWare\DailyCP-master\DailyCP.py", line 239, in <module> main(sys.argv[1:]) File "C:\Other\SoftWare\MySoftWare\DailyCP-master\DailyCP.py", line 236, in main app.autoComplete(address) File "C:\Other\SoftWare\MySoftWare\DailyCP-master\DailyCP.py", line 176, in autoComplete detail = self.getCollectorDetail(item["wid"]) File "C:\Other\SoftWare\MySoftWare\DailyCP-master\DailyCP.py", line 124, in getCollectorDetail url = ret["form"]["formContent"] TypeError: 'NoneType' object is not subscriptable
修改以用于输出ret.text的代码
def getCollectorDetail(self, collectorWid): url = "https://{host}/wec-counselor-collector-apps/stu/collector/detailCollector".format(host=self.host) body = { "collectorWid": collectorWid } self.session.headers["Content-Type"] = "application/json" ret = self.session.post(url, data=json.dumps(body)) print(ret.text) ret = json.loads(ret.text)["datas"] url = ret["form"]["formContent"] return ret
我也是,打印出来没有row对象。只有{'datas': {'WEC-REDIRECTURL': '/portal/login', 'WEC-HASLOGIN': False}, 'code': 0, 'message': 'successs'}