bot.forward_message(int('мой айди'), message.chat.id, message.message_id)
try:
from ssl import PROTOCOL_TLS as default_ssl_protocol
except ImportError:
from ssl import PROTOCOL_SSLv23 as default_ssl_protocol
ssl_context = default_ssl_protocol
rosreestr
, у Росреестра сертификат от DigiCert, который в марте отзывал у санкционных организаций свои TLS сертификаты, проблема также может быть в этом. Отзывался ли у Росреестра не знаюaiohttp.ClientSession(
connector=aiohttp.TCPConnector(verify_ssl=False)
)
aioimaplib
для чтения и aiosmtplib
для отправки callback_data=data['address']
, в функции send_to_support_call
используете callback_data['address'] вместо data['address']user_id = int(callback_data.get("user_id"))
если вы не используете user_id из своей БД, а это user_id телеграма то зачем передавать в callback_data, если по умолчанию есть в callback query, и ниже вы его используете user_id=call.from_user.id
import json
import re
import requests
req = requests.get('https://steamcommunity.com/market/listings/730/Recoil%20Case')
search = re.search('var line1=(.+);', req.text)
data_str = search.group(1)
data = json.loads(data_str)
for x in data:
date = x[0]
usd_price = x[1]
num_of_sales = x[2]
print(date, float(usd_price), num_of_sales)
list_price = [float(x[1]) for x in data]
# Магическое число "2" для форматирования float до двух знаков после запятой
# Форматирование в f строке :.{2}f
print(f"Общее кол-во сделок: {sum([int(x[2]) for x in data]):.{2}f}")
print(f"Общая сумма сделок: {sum(list_price):.{2}f}")
if request.method == 'POST':
body = request.body.decode("utf-8")
orders = body.split('\n')
order_with_big_bags = {}
for parcel in orders:
bb_id = connect(table='parcels',
field='document_id',
equally=parcel,
item='big_bag_id')
try:
if isinstance(order_with_big_bags[bb_id], list):
order_with_big_bags[bb_id].append(parcel)
except KeyError:
order_with_big_bags[bb_id] = [parcel]
return Response(order_with_big_bags)
if request.method == 'POST':
body = request.body.decode("utf-8")
orders = body.split('\n')
order_with_big_bags = {}
for parcel in orders:
bb_id = connect(table='parcels',
field='document_id',
equally=parcel,
item='big_bag_id')
if bb_id not in order_with_big_bags:
order_with_big_bags[bb_id] = [parcel]
else:
order_with_big_bags[bb_id].append(parcel)
return Response(order_with_big_bags)
def get_bb_id(parcel):
return connect(table='parcels',
field='document_id',
equally=parcel,
item='big_bag_id')
order_with_big_bags = {get_bb_id(parcel): [parcel] for parcel in orders}
print(order_with_big_bags)
Код теперь не выберет занятую клетку пользователем