Во время обработки вышеуказанного исключения произошло другое исключение:
pymysql.err.OperationalError: (2003, «Не удается подключиться к серверу MySQL»
на \ '"example.mysql.com" \' (
[Errno 11001] Не удалось выполнить getaddrinfo) ')
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] Ошибка getaddrinfo
try:
connection = pymysql.Connect(host =self.host, port = 3306,user = self.user, password = self.password, db = self.db, charset ='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
print('conneciton to the server is live')
return connection
except ConnectionError as ce:
print(ce)
else:
print('Cold not connect to the server')