MySQL Connector/Python Developer Guide

10.2.25 MySQLConnection.is_connected() Method

Reports whether the connection to MySQL Server is available.

This method checks whether the connection to MySQL is available using the ping() method, but unlike ping(), is_connected() returns True when the connection is available, False otherwise.