import requests
import json
base_url = 'https://api.easypay.ua/api/payment/getReceipt'
data = {'receiptId': 'id транзакции', 'amount': 'сумма'}
headers = {'Accept': 'text/html'}
response = requests.get(base_url, data, headers=headers)
if response:
print('Success!')
else:
print('Pay not found.')
def post_sql_query(sql_query):
with sqlite3.connect('base.db') as connection:
cursor = connection.cursor()
try:
cursor.execute(sql_query)
except Error:
print(Error)
result = cursor.fetchall()
return result
def delete_user(users_id):
del_user_query = f'DELETE FROM users WHERE users_id = {users_id};'
post_sql_query(del_user_query)
from telegram.error import (TelegramError, Unauthorized, BadRequest,
TimedOut, ChatMigrated, NetworkError)
try:
bot.send_message(user_id, text)
except telegram.error.BadRequest:
delete_user(users_id)
dispatcher.add_error_handler(error_callback)
elif mail == True:
mail = False
text = base_work.all_id()
bot.send_message(message.chat.id, 'В течении 3 секунд, отправиться всем пользователям!')
for i in text:
try:
bot.forward_message(i[0], message.chat.id, disable_notification=True, message_id=message.message_id)
except:
pass
t.cancel()
def ordertimeout():
if message.text == 'Оплата':
bot.send_message(message.chat.id, '✖Отменить Заказ')
t = threading.Timer(1*10, ordertimeout) # 10 минут (или 600 секунд)
t.start() # время пошло!
t.cancel() # отмена, не будет запущен
def answer(bot, update):
global mail, city, cit, rayon,lol, tovari, lol1, tovar
message = update.message
if (message.chat.id in constants.admins) and message.text == 'Рассылка':
mail = True
bot.send_message(message.chat.id, 'Напишите сообщение!')
elif mail == True:
mail = False
bot.send_message(message.chat.id, 'В течении 3 секунд, отправиться всем пользователям!')
for i in base_work.all_id():
try:
bot.forward_message(i[0], message.chat.id, message_id=message.message_id, disable_notification=False)
bot.send_message(message.chat.id, 'Все')
except:
pass
elif (message.chat.id in constants.admins) and message.text == 'Все пользователи':
text = base_work.all_about_user()
for i in text:
bot.send_message(message.chat.id, texts.user_text %(i[0], i[1],i[2]))