Я пытаюсь создать функцию, которая будет обрабатывать сообщения об ошибках API, но я получаю это сообщение об ошибке в Python:
Exception has occurred: sqlite3.OperationalError
near "Test4": syntax error
Ответ сервера:
{"message":"Failed to validate one or more request parameters","validationErrors":["Budget name must be unique. 'Test4 - X4574747-PHONE' already exits"]}
Имой код:
def error():
if "message" in r.json():
logText = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + " : " + r.json()['message']
c.execute("INSERT INTO log VALUES ('"+ logText +"')")
conn.commit()
if "validationErrors" in r.json():
logText = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + " : " + r.json()['validationErrors'][0]
c.execute("INSERT INTO log VALUES ('"+ logText +"')")
conn.commit()
os._exit(1)
Я не могу понять, что вызывает эту ошибку.Любая помощь будет оценена.Спасибо.