对于有API接口数据的监测

对于有API接口数据的监测爬取

import requests
import time
import webbrowser #用于打开网页
api = "https://api.github.com/repos/channelcat/sanic"
web_page = "https://github.com/channelcat/sanic"
last_updata = None
all_info = requests.get(api).json()#json与反jison,要与文件的json做区分
cur_updata = all_info["updated_at"]#为什么感觉很有道理的样子
print(cur_updata)
while True:
    if not last_updata:
        last_updata = cur_updata
    if last_updata < cur_updata:#同一格式的字符串的对比
        webbrowser.open(web_page)
    time.sleep(600)#不能无休息的进行操作

原文地址:https://www.cnblogs.com/yangzilaing/p/13711487.html