Created
May 18, 2020 13:59
-
-
Save tomoyk/fea7ec07f4dc8d088da021f9711f9f5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from colored import fg, bg, attr | |
import requests | |
r = requests.get('https://status.classi.jp/') | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(r.text, "lxml") | |
status_all = soup.find_all("div", {"class": "component-inner-container"}) | |
for status in status_all: | |
try: | |
# print(status.span) | |
service_name = status.span.text.strip() | |
service_status = status.find("span", {"class": "component-status"}).text.strip() | |
excludes = {"Web(主要機能)", "iOSアプリ", "Androidアプリ"} | |
if service_name in excludes: | |
continue | |
elif service_name == 'アプリプッシュ通知/メール通知': | |
break | |
if service_status in 'Operational': | |
print('%sOperational%s\t%s' % (bg('green'), attr(0), service_name)) | |
elif service_status in 'Degraded Performance': | |
print('%sLittle Delay%s\t%s' % (bg('orange_3'), attr(0), service_name)) | |
elif service_status in 'Major Outage': | |
print('%sMajor Outage%s\t%s' % (bg('red'), attr(0), service_name)) | |
else: | |
print(service_name, service_status) | |
except Exception: | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
できたやつ