How to check if Facebook is down with Python

1 min

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 !