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)