create or replace function "bd"."function"("reg" int4, "date" date)
returns table("4.1" bigint, "5.1" bigint, "7.1" int4, "8.1" int4, "9.1" int4, "10.1" int4, "11.1" int4, "12.1" int4, "10.1" int4, "14.1" int4, "15.1" int4, "18.1" int4, "19.1" int4) as $body$
create or replace function "bd"."function"("reg" int4, "date" date)
returns table("4.1" bigint, "5.1" bigint, "7.1" int4, "8.1" int4, "9.1" int4, "10.1" int4, "11.1" int4, "12.1" int4, "10.1" int4, "14.1" int4, "15.1" int4, "18.1" int4, "19.1" int4) as $body$
import telebot
from telebot import types
import requests
import uuid
bot = telebot.TeleBot("MY_TOKEN")
session_id = uuid.uuid4()
url="MY_LINK"
headers = {'content-type': 'text/xml'}
request1 = f"""<typ:simple>
<typ:attributeName>Session_Id</typ:attributeName>
<typ:value>{session_id}</typ:value>
</typ:simple>"""
request2 = f"""<typ:simple>
<typ:attributeName>Session_Id</typ:attributeName>
<typ:value>{session_id}</typ:value>
</typ:simple>"""
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.send_message(
message.chat.id,
"""Тестовое сообщение""",
reply_markup=keyboard())
def keyboard():
markup = types.ReplyKeyboardMarkup(one_time_keyboard=False, resize_keyboard=True)
markup.add('запрос1')
return markup
@bot.message_handler(content_types=['text'])
def send_text(message):
if message.text.lower() == 'запрос1':
def generate():
session_id = uuid.uuid4()
return session_id
response1 = requests.post(url,data=request1.encode('utf-8'),headers=headers)
answer1 = response1.content.decode('UTF-8')
status_code1 = response1.status_code
bot.send_message(message.chat.id, answer1, status_code1)
if 'Session_Id' in answer1:
response2 = requests.post(url,data=request2.encode('utf-8'),headers=headers)
answer2 = response2.content.decode('UTF-8')
status_code2 = response2.status_code
bot.send_message(message.chat.id, answer2, status_code2)
bot.polling(none_stop = True)