用python向电报机器人发送结果查询Oracle
各位用python向电报机器人发送结果查询Oracle,python,oracle,python-telegram-bot,Python,Oracle,Python Telegram Bot,各位 有没有人有过执行oracle查询并通过python中的电报机器人发送消息的例子?我只能回答你问题的一半,即通过python中的电报机器人发送消息 创建您的机器人 在电报中,搜索@BotFather,给他发送一条“/开始”消息 发送另一条“/newbot”消息,然后按照说明设置名称和用户名 您的bot现在已准备就绪,请确保保存API令牌的备份,并且正确,此API令牌是您的bot\u令牌 获取您的聊天id 在电报中,搜索您的机器人(通过您刚刚创建的用户名),按“开始”按钮或发送“/开始”消息
有没有人有过执行oracle查询并通过python中的电报机器人发送消息的例子?我只能回答你问题的一半,即通过python中的电报机器人发送消息 创建您的机器人
import requests
def telegram_bot_sendtext(bot_message):
bot_token = '<INSERT_API_KEY>'
bot_chatID = '<INSERT_CHATID>'
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()
test = telegram_bot_sendtext("Testing Telegram bot")
print(test)
导入请求
def电报发送文本(bot消息):
bot_令牌=“”
bot_chatID=“”
发送文本信息https://api.telegram.org/bot“+bot\u令牌+”/sendMessage?聊天室id=”+bot\u聊天室id+”&parse\u mode=Markdown&text='+bot\u消息
response=requests.get(发送文本)
返回response.json()
测试=电报机器人发送文本(“测试电报机器人”)
打印(测试)
import requests
def telegram_bot_sendtext(bot_message):
bot_token = '<INSERT_API_KEY>'
bot_chatID = '<INSERT_CHATID>'
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()
test = telegram_bot_sendtext("Testing Telegram bot")
print(test)