How to check if Facebook is down with Python

1 min readAPIWebscrapingDataData Gathering
7-Day Challenge

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.

Build portfolios that hiring managers love
Master the Python and SQL essentials to be industry-ready
Practice with real interview questions from tech companies
Access to the $100k/y Data Scientist Cheatsheet

Join thousands of developers who transformed their careers through our challenge. Unsubscribe anytime.

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 !

7-Day Challenge

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.

Build portfolios that hiring managers love
Master the Python and SQL essentials to be industry-ready
Practice with real interview questions from tech companies
Access to the $100k/y Data Scientist Cheatsheet

Join thousands of developers who transformed their careers through our challenge. Unsubscribe anytime.

Free Newsletter

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. 📚

Weekly simple and practical lessons
Access to ready to use code examples
Skip the math, focus on results
Learn while drinking your coffee

By subscribing, you agree to receive our newsletter. You can unsubscribe at any time.