# 6. 直接将获取的数据存入index.py
filename="index.py"
i=0
with open(filename,'r',encoding='utf-8') as r:
lines=r.readlines()
for line in lines:
if "Cookies" in line:
lines[i]="Cookies = "+ str(requests.utils.dict_from_cookiejar(session.cookies))+"\n"
if "sessionToken" in line:
lines[i]="sessionToken = '" + sessionToken + "'\n"
if "CpdailyInfo" in line:
lines[i]="CpdailyInfo = '" + CpdailyInfo + "'\n"
break
i=i+1
with open(filename,'w',encoding='utf-8') as r:
for line in lines:
r.write(line)
只需要将index的配置格式改成 Cookies sessionToken CpdailyInfo