How to check if Facebook is down with Python
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
Today is the day on which Facebook disappeared from the surface of the earth.
Oh maybe it seems
Along with Instagram and Whatsapp, leaving Twitter and Tiktok having the time of their life taking care of the angry customer that Facebook left behind.
I thought of doing this as a response to this Facebook outage and to give you a tool to check whether Facebook is still online.
import requests
try:
requests.get("https://facebook.com", timeout=10)
except requests.exceptions.ConnectionError:
print("Facebook seems to be down")
Using the requests library we can check whether a website is down or not.
Most website give a feedback in less than 10 seconds. This is why we set a timeout at 10.
If after 10 seconds the given url doesn't give any sign of life, requests will throw a connection error exception.
We then print the message that something is going on and Facebook seems to be down.
Here you are ! You are now ready for the next general Facebook outage !
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
Related Articles
Continue your learning journey with these related topics
Master Data Science in Days, Not Months 🚀
Skip the theoretical rabbit holes. Get practical data science skills delivered in bite-sized lessons – Approach used by real data scientist. Not bookworms. 📚