selenium检测GitHub项目

import time
import requests
from selenium import webdriver


name = "psf/requests"

api = "https://api.github.com/repos/"+name
weburl = "https://github.com/"+name

old_time = None
while True:
    r = requests.get(api)
    if r.status_code != 200:
        print("请求API失败")
        break

    # json -> dict
    now_time = r.json()["updated_at"]
    if not old_time:
        old_time = now_time

    if old_time < now_time:
        print("项目更新了")
        driver = webdriver.Chrome(executable_path="chromedriver.exe")
        driver.get(weburl)

    # 60 * 10 -> 10分钟
    time.sleep(600)
上一篇:ensp启动失败,此应用无法在此设备上运行


下一篇:【记录】服务启动脚本管理