我有一个 Flask-AppBuilder 网页,我想为我们的员工创建一个新页面,用于向电报发送消息
模型:
class Push(Model):
__tablename__ = 'push'
id = Column(Integer, primary_key=True)
content = Column(String(255), nullable=False)
def __repr__(self):
return self.name
看法 :
def testaction(self,Push):
result = db.session.query(Push).all()
return str(result)
bot_token = 'TOKEN'
bot_chatID = 'ID'
send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + bot_message
response = requests.get(send_text)
return response.json()
bot_message = testaction(result)
print(bot_message)
但有一个错误:
sqlalchemy.exc.InvalidRequestError
sqlalchemy.exc.InvalidRequestError: SQL expression, column, or mapped entity expected - got '[hi]'
AND 不将消息发送到电报