Как исправить ошибку SSL (multiprocessing) в боте Telegram?
token = ''
URL = f'https://api.telegram.org/bot{token}' # URL на который отправляется запрос
print(requests.get(URL + '/getUpdates', verify=False).json()) #GET запрос к API Telegram для получение словаря данных
bot = telebot.TeleBot(token)
def send_annul(sec, id_order, date_order, sum_order):
print('Заказ №' + id_order)
time.sleep(sec) # через 15 сек отправляю сообщение # если время не прошло, жду
conn_DB.upd_statusOrders('Аннулирован', int(id_order))
# bot = telebot.TeleBot(token, threaded=False)
bot.send_message(message.chat.id, text = f'*\u3030ЗАКАЗ №1 АННУЛИРОВАН* от 1 на сумму 1 руб.',
parse_mode = "Markdown", reply_markup = send_keyb_order(buttons.ls_keybs_orders(message.chat.id)[2]))
def worker():
global proc
# proc = multiprocessing.Process(target=worker(f"{conn_DB.id_Zakaz()}", f"{zakaz[2]}", f"{zakaz[4]}"))
proc = multiprocessing.Process(target=send_annul, args=(10, f"{conn_DB.id_Zakaz()}", 1, 1))
print(proc)
proc.start()
# proc.terminate()
worker()
Ошибка в момент вызова метода send_message():

Текст ошибки: File "/usr/lib/python3.8/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac')]
Ответы (1 шт):
Автор решения: Karina
→ Ссылка
Решение:
def post_annulOrder(id_order, date_order):
print('Отправка сообщения об аннулировании заказа')
requests.post(f'{URL}/sendMessage', data = {'chat_id': 454752968, 'text': f'*\u3030ЗАКАЗ № {id_order}* от {date_order} на сумму 1 руб.- АННУЛИРОВАН!',
'parse_mode': 'Markdown'})
Я недооценивала запросы с помощью http (в боте)