sti = open('1.webp', 'rb')
bot.send_sticker(message.chat.id, sti)
bot.send_sticker(message.chat.id, sti)
bot.send_sticker(message.chat.id, open('1.webp', 'rb'))
bot.send_sticker(message.chat.id, open('1.webp', 'rb'))
secret = '43d2yIyIVM'
username = 'user'
bot.remove_webhook()
time.sleep(1)
bot.set_webhook(url='https://{}.pythonanywhere.com/{}'.format(username, secret))
app = Flask(__name__)
@app.route('/{}'.format(secret), methods=["POST"])
def webhook():
bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
return 'ok', 200
то выводит все строки, но последняя строка None
print(get_all())
что лиdef get_all():
records = []
cur.execute('SELECT * FROM stocks')
rows = cur.fetchall()
for row in rows:
records.append({'name': str(row[1]), 'id': str(row[0])})
return records
for line in f:
s = str(f.readline())
k = 0
with open('24.txt') as f:
for line in f:
ka = 0
ke = 0
for char in line:
if char == 'A':
ka += 1
elif char == 'E':
ke += 1
if ke > ka:
k += 1
print(k)
for tovar in tovars:
photo = open(tovar[3], 'rb')
caption = f"Назва: {tovar[1]}.\nОпис: {tovar[2]}.\nЦіна: {tovar[6]} грн."
tovarKeyboard=types.InlineKeyboardMarkup()
tovarKeyboard.add(types.InlineKeyboardButton(text="Перейти до товару на сайті", url=tovar[4]))
bot.send_photo(call.message.chat.id, photo, caption, reply_markup=tovarKeyboard)
for i in range(0, len(table[0]), 1):
table[0]
, а в вашем вместо 0 выступает переменная i, равная 0. return f"{trending}"
return trending
пусть будетtrending = requests.get("http://45.141.184.**:****/getTranding", params=data)
for tiktok in json.loads(trending.text):
from flask import jsonify
@app.route('/getTranding')
def getTranding():
if request.args.get('count'):
trending = api.trending(count=int(request.args.get('count')))
return jsonify(trending)
a = sorted(list(lst[i]))
a.reverse()
a = sorted(list(lst[i]), reverse=True)