代码拉取完成,页面将自动刷新
同步操作将从 ghc/flask_dengji 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import schedule
import time
import os
import requests
from datetime import datetime
def create_table():
os.system('python auto_create_table.py')
def create_recoding_sheet():
os.system('python create_recoding_sheet.py')
def update_banji_table():
try:
os.system('python 班级课表.py')
except:
pass
def update_class_table():
try:
os.system('python kebiao.py')
except:
pass
def crawl_weather():
try:
r = requests.get('http://t.weather.sojson.com/api/weather/city/101110101', headers=header, timeout=10)
with open('weather.json', 'w', encoding='utf-8') as f:
f.write(r.text)
print('%s 更新天气完成' % datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
except BaseException as e:
print('天气出错 %s' % e)
pass
def run_hebing():
try:
os.system('python 合并.py')
print('成功合并所有机房课表')
except Exception as e:
print('合并出错 %s' % e)
header = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'}
crawl_weather()
create_table()
run_hebing()
# 每天七点定时创建数据库
schedule.every().day.at("06:00").do(update_banji_table)
schedule.every().day.at("07:00").do(create_table)
schedule.every().day.at("07:10").do(update_class_table)
# schedule.every().day.at("04:30").do(crawl_weather)
schedule.every().day.at("07:30").do(crawl_weather)
schedule.every().day.at("07:45").do(run_hebing)
# schedule.every().day.at("07:45").do(crawl_weather)
schedule.every().day.at("08:30").do(crawl_weather)
# schedule.every().day.at("09:00").do(crawl_weather)
# schedule.every().day.at("09:30").do(crawl_weather)
# schedule.every().day.at("10:54").do(crawl_weather)
# schedule.every().day.at("14:20").do(crawl_weather)
# schedule.every().day.at("20:38").do(crawl_weather)
schedule.every().day.at("23:00").do(create_recoding_sheet)
while True:
try:
schedule.run_pending()
time.sleep(1)
except:
pass
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。