Загрузка...

Fool Me or Aiogram

Thread in Python created by pijawca Jun 27, 2020. 732 views

The poll
А
Results are only viewable after voting.
Results are only viewable after voting.
  1. Я (ну ты)

    100%
  2. А понял

    0%
  1. pijawca
    pijawca Topic starter Jun 27, 2020 че тут нового на этом вашем лолзе 295 Jul 17, 2019
    Модуль с которого я импортирую:

    Code
    import requests
    import lxml.html
    import re

    def unic_number():
    url = ('http://zalupa.ru')
    api = requests.get(url)
    tree = lxml.html.document_fromstring(api.text)
    number = tree.xpath('/html/body/div/main/div/div/div[1]/div/div[2]/text()')
    reforge_number = (str(number))
    a = re.sub(r'\D', '', reforge_number)
    aa = (str(a[0:5]))
    return (aa)

    def balance():
    url = ('http://zalupa.ru')
    api = requests.get(url)
    tree = lxml.html.document_fromstring(api.text)
    balance = tree.xpath('/html/body/div/main/div/div/div[2]/div[1]/div[2]/span/text()')
    reforge_balance = (str(balance))
    b = re.sub(r'\D', '', reforge_balance)
    bb = (str(b[0:3]))
    return (bb)
    Сам бот:

    Code
    @dp.message_handler(Text(equals=['Hello', 'World']))
    async def zalupenc(message: Message):
    if message.text == 'Hello':
    await message.reply(test.unic_number())
    if message.text == 'World':
    await message.reply(test.balance())
    Что выдает консоль при нажатии World:
    Code
    aiogram.utils.exceptions.BadRequest: Unsupported parse_mode
    Вопрос.
    При нажатии на 'Hello' всё ок
    При нажатии на 'World' нихуя. (выходит ошибка)
    Если менять местами то World работает а Hello не работает. Чё блять делать? Не могу нихуя понять хотя код идентичный.
     
  2. meaqese
    meaqese Jun 27, 2020 265 Oct 18, 2016
    В большинстве случаев дурак именно вы. Код просто рвет глаза
     
    1. pijawca Topic starter
      meaqese, М, годный совет. Спасиба папаша.:fig:
  3. Delitel
    Delitel Jun 28, 2020 198 Feb 4, 2018
    обрати внимание на world
    The post was merged to previous Jun 28, 2020
    тебе ошибку по parse_mode выдало вообще
     
    1. View previous comments (3)
    2. Delitel
    3. pijawca Topic starter
      Delitel,
      Code
      ERROR:asyncio:Task exception was never retrieved
      future: <Task finished name='Task-32' coro=<Dispatcher._process_polling_updates() done, defined at C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\dispatcher\dispatcher.py:325> exception=BadRequest('Unsupported parse_mode')>
      Traceback (most recent call last):
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 333, in _process_polling_updates
      for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 188, in process_updates
      return await asyncio.gather(*tasks)
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
      response = await handler_obj.handler(*args, **partial_data)
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 208, in process_update
      return await self.message_handlers.notify(update.message)
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
      response = await handler_obj.handler(*args, **partial_data)
      File "E:/.Cloud/Python/@aa/@tlgram/main.py", line 30, in cabinet_ITK
      await message.reply(message.text, '<b>askgfk</b>', (test.balance()))
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\types\message.py", line 876, in reply
      return await self.bot.send_message(chat_id=self.chat.id,
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\bot\bot.py", line 219, in send_message
      result = await self.request(api.Methods.SEND_MESSAGE, payload)
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\bot\base.py", line 201, in request
      return await api.make_request(self.session, self.__token, method, data, files,
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\bot\api.py", line 104, in make_request
      return check_result(method, response.content_type, response.status, await response.text())
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\bot\api.py", line 78, in check_result
      exceptions.BadRequest.detect(description)
      File "C:\Users\Tourist\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiogram\utils\exceptions.py", line 137, in detect
      raise cls(description)
      aiogram.utils.exceptions.BadRequest: Unsupported parse_mode
      Но блять если менять местами всё ворк, я не могу понять нихуя. Парс мод ставил HTML а чё толку он точно также выдает.
    4. pijawca Topic starter
      Delitel, Да знаю что эта ошибка вылетает, я пытался её просто как затычку сделать. Не ворк.
    5. View the next comments (4)
  4. pijawca
    pijawca Topic starter Jun 28, 2020 че тут нового на этом вашем лолзе 295 Jul 17, 2019
    Решил. Ошибка в самом коде.
     
Top
Loading...