apk add python3 curl
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
import asyncio
from contextlib import suppress
from aiogram import types
from aiogram.utils.exceptions import (MessageToEditNotFound, MessageCantBeEdited, MessageCantBeDeleted,
MessageToDeleteNotFound)
async def delete_message(message: types.Message, sleep_time: int = 0):
await asyncio.sleep(sleep_time)
with suppress(MessageCantBeDeleted, MessageToDeleteNotFound):
await message.delete()
msg = await message.reply("Я удалюсь через 30 секунд")
asyncio.create_task(delete_message(msg, 30))
рандомную фотографию из папки проекта ?можно так
import glob, os, random
files = []
for ext in ["png", "jpg", "jpeg"]:
[files.append(file) for file in glob.glob(f"*.{ext}")]
random_file = files[random.randint(0, len(files)-1)]
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.data == 'men':
with open(random_file, 'rb') as f:
bot.send_media_group(call.message.chat.id, [InputMediaPhoto(f)])
<form action="https://api.vk.com/method/messages.send" method="GET" target="frameresult">
<input type="hidden" name="chat_id" value="2">
<input type="hidden" name="v" value="5.80">
<input type="hidden" name="access_token" value="ТОКЕН ГРУППЫ">
<label for="message">Сообщение:</label><br>
<textarea name="message" id="message" style="max-width:300px; max-height:200px;"></textarea>
<div style="text-align:center;">
<button type="submit">Отправить</button>
</div>
</form>
<iframe name="frameresult"></iframe>
function fallbackCopyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.position="fixed"; //avoid scrolling to bottom
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Fallback: Copying text command was ' + msg);
} catch (err) {
console.error('Fallback: Oops, unable to copy', err);
}
document.body.removeChild(textArea);
}
function copyTextToClipboard(text) {
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(function() {
console.log('Async: Copying to clipboard was successful!');
}, function(err) {
console.error('Async: Could not copy text: ', err);
});
}
copyTextToClipboard( "Твой текст" );
pip install --user requests
в командной строке cmd (он же терминал, она же консоль)import requests, urllib.parse, json, re
s = requests.session()
ua = r"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0"
s.headers = {"User-Agent": ua}
url = 'https://money.yandex.ru/'
login = 'vasya-ivanov'
password = 'secret'
resp = s.get(url, allow_redirects = True).content.decode("utf8")
if not "balance-widget__amount" in resp:
authurl = "https://passport.yandex.ru/auth?origin=money&retpath=https%3A%2F%2Fmoney.yandex.ru%2F"
resp = s.get(authurl, allow_redirects = True).content.decode("utf8")
token = re.search(r'data-csrf="([^"]+)"', resp).group(1)
resp = s.post(authurl, headers = {
"Referer":authurl
}, data = {
"retpath":url,
"fretpath":"",
"clean":"",
"service":"",
"origin":"",
"policy":"",
"is_pdd":"",
"csrf_token": token,
"login":login,
"hidden-password":password,
"passwd":password,
"twoweeks":"no"
}, allow_redirects = True).content.decode("utf8")
resp = s.get(url, allow_redirects = True).content.decode("utf8")
r = re.search(r'<div class="balance-widget__amount">.*?>([\d]+)<.*?>([\d]+)<', resp)
balance = float(r.group(1)+"."+r.group(2))
price_label = re.search(r'<span.*?price__label.*?">([^<]+)</span>', resp).group(1)
print("Я спарсил баланс!", balance, price_label)