driver = creat_chrome()
driver.get(url)
WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.ID, "DisplayNewsDetails_main_div")))
innerHTML = driver.execute_script("return document.documentElement.outerHTML")
innerHTML = driver.execute_script("return document.documentElement.outerHTML")
сайте потом дает тебе HTML client.request_callback_answer(
chat_id=message.chat.id,
message_id=message.message_id,
callback_data=message.reply_markup[i][j].callback_data
)
import logging
LOG = logging.getLogger(__name__)
def handle_silently(function):
def wrapped(*args, **kwargs):
result = None
try:
result = function(*args, **kwargs)
except Exception as e:
LOG.error(
'{}(*{}, **{}) failed with exception {}'.format(
function.__name__, repr(args), repr(kwargs), repr(e)
)
)
return result
return wrapped
@handle_silently
def some_function(test):
return test / 0
def decorators_fabric(handler_function):
def decorator(function):
def wrapped(*args, **kwargs):
handler_function(function.__name__, repr(args), repr(kwargs))
return function(*args, **kwargs)
return wrapped
return decorator
@decorators_fabric(print)
def my_test_function(arg1, arg2):
return arg1 * arg2
1. <a href="tg://user?id=123456789">inline mention of a user</a>' с parse_mode = html
2. [inline mention of a user](tg://user?id=123456789) с parse_mode = MarkdownV2
bot.clear_step_handler_by_chat_id(chat_id=call.message.chat.id)
@bot.message_handler(commands=['start'])
def process_start(message):
board = types.InlineKeyboardMarkup()
cancel = types.InlineKeyboardButton(text="Отмена", callback_data="Отмена")
board.add(cancel)
text = 'start'
msg = bot.send_message(message.chat.id, text, reply_markup=board)
bot.register_next_step_handler(msg, process_mid)
def process_mid(message):
board = types.InlineKeyboardMarkup()
cancel = types.InlineKeyboardButton(text="Отмена", callback_data="Отмена")
board.add(cancel)
text = 'mid'
msg = bot.send_message(message.chat.id, text, reply_markup=board)
bot.register_next_step_handler(msg, process_end)
def process_end(message):
text = 'end'
bot.send_message(message.chat.id, text)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.message:
if call.data == "Отмена":
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text='Отменено.')
bot.clear_step_handler_by_chat_id(chat_id=call.message.chat.id)
bot.polling(none_stop=True)
CHANNEL_ID = 0 # Some ID
@bot.callback_query_handler(func=lambda call: True)
def iq_callback(call: types.CallbackQuery):
if call.data == 'choice_clear':
# Some code to clear
return
msg: types.Message = call.message
if msg.content_type == 'text':
bot.send_message(CHANNEL_ID, msg.text)
elif msg.content_type == 'photo':
bot.send_photo(CHANNEL_ID, msg.photo[0].file_id, msg.caption)
message.from_user.id
message.from_user.first_name
message.from_user.last_name
message.from_user.username
widget = MyTableWidget()
...
def sendAcc(self, widget):
widget.addRefreshAcc()
pass