Skip to content

Instantly share code, notes, and snippets.

@tomoyk
Created May 18, 2020 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoyk/fea7ec07f4dc8d088da021f9711f9f5c to your computer and use it in GitHub Desktop.
Save tomoyk/fea7ec07f4dc8d088da021f9711f9f5c to your computer and use it in GitHub Desktop.
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
@tomoyk
Copy link
Author

tomoyk commented May 18, 2020

できたやつ

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment