S
Size: a a a
S
А
class Item(StatesGroup):
item_id = State()
@dp.message_handler(commands="start", state="*")
async def name_step(message: types.Message, state: FSMContext):
await message.answer(text='Напиши item_id ')
await Item.item_id.set()
@dp.message_handler(state=Item.item_id)
async def start(message: Message, state: FSMContext) -> NoReturn:
await state.update_data(item_id=message.text) # тут сохраняется твой item_id
#item = await state.get_data()
await message.answer(text='{}'.format(get_tables(Item.item_id)), parse_mode='HTML')
if __name__ == '__main__':
executor.start_polling(dp)
Где get_tables(Item.item_id) это dataframe в виде 3 табличекprint(str(get_tables(Item.item_id)))
S
print(str(get_tables(Item.item_id)))
def get_tables(item_id):
urls = {'Azure': 'http://l2on.net/?c=market&a=item&id={}&setworld=3056'.format(item_id), 'Emerland': 'http://l2on.net/?c=market&a=item&id={}&setworld=3062'.format(item_id), 'Cherry': 'http://l2on.net/?c=market&a=item&id={}&setworld=3055'.format(item_id)}
#servers = ['Azure', 'Emerland', 'Cherry']
for key in urls:
html = requests.get(urls[key]).content
crypto_data = pd.read_html(html, encoding='cp1251', skiprows=1)
print('\n'+key)
print(crypto_data[0].iloc[:,1:4].head(10))
Потому что ид нужно в эту функцию вставлятьА
def get_tables(item_id):
urls = {'Azure': 'http://l2on.net/?c=market&a=item&id={}&setworld=3056'.format(item_id), 'Emerland': 'http://l2on.net/?c=market&a=item&id={}&setworld=3062'.format(item_id), 'Cherry': 'http://l2on.net/?c=market&a=item&id={}&setworld=3055'.format(item_id)}
#servers = ['Azure', 'Emerland', 'Cherry']
for key in urls:
html = requests.get(urls[key]).content
crypto_data = pd.read_html(html, encoding='cp1251', skiprows=1)
print('\n'+key)
print(crypto_data[0].iloc[:,1:4].head(10))
Потому что ид нужно в эту функцию вставлятьS
def get_tables(item_id):
urls = {'Azure': 'http://l2on.net/?c=market&a=item&id={}&setworld=3056'.format(item_id), 'Emerland': 'http://l2on.net/?c=market&a=item&id={}&setworld=3062'.format(item_id), 'Cherry': 'http://l2on.net/?c=market&a=item&id={}&setworld=3055'.format(item_id)}
#servers = ['Azure', 'Emerland', 'Cherry']
for key in urls:
html = requests.get(urls[key]).content
crypto_data = pd.read_html(html, encoding='cp1251', skiprows=1)
return('\n'+key+ '\n' + str(crypto_data[0].iloc[:,1:4].head(10)))
Вот изменил теперь присылаетS
S
S
А
def get_tables(item_id):
urls = {'Azure': 'http://l2on.net/?c=market&a=item&id={}&setworld=3056'.format(item_id), 'Emerland': 'http://l2on.net/?c=market&a=item&id={}&setworld=3062'.format(item_id), 'Cherry': 'http://l2on.net/?c=market&a=item&id={}&setworld=3055'.format(item_id)}
#servers = ['Azure', 'Emerland', 'Cherry']
for key in urls:
html = requests.get(urls[key]).content
crypto_data = pd.read_html(html, encoding='cp1251', skiprows=1)
return('\n'+key+ '\n' + str(crypto_data[0].iloc[:,1:4].head(10)))
Вот изменил теперь присылаетI
S
S
NP
K
S
A
K
A
k