ZimoLoveShuang / auto-submit

今日校园自动提交疫情上报,通用
Apache License 2.0
680 stars 206 forks source link

对login的建议 #9

Closed qqqeMber closed 4 years ago

qqqeMber commented 4 years ago
# 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

ZimoLoveShuang commented 4 years ago

建议挺好的,只是我懒得改了,改了脚本还要改说明,挺麻烦,原谅我的懒