等Centos8等的都没耐心了,下午写了个判断脚本

一直在测试 RHEL8,总的来说,还是比较符合预期的,就是非注册版本,诸多限制,等 Centos8 出来后,要在内网部署,做小程序测试,等到现在,快没耐心了 :(

一直登陆centos.org网站,麻烦,写个python3脚本跑吧,每天对比一下版本号。


#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Filename:centosversion.py

import requests
import re
import operator
from bs4 import BeautifulSoup

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'}

page = requests.get('https://www.centos.org', headers)

html = page.content

soup = BeautifulSoup(html, 'html.parser')
for k in soup.find_all(href=re.compile("https://wiki.centos.org/Manuals/ReleaseNotes/"), limit=1):
        data = k['href']
        if operator.eq(data[-1], 8):
                print("OK")
        else:
                print("FALSE")