Beispiel #1
0
 def send_result(self):
     self.get_result()
     if not self.items:
         bot.edit_message_text(
             chat_id=self.message.chat.id,
             message_id=self.message.message_id,
             reply_markup=Utils.MARKUPS['Home'],
             text="No items were found. Please, try another request")
         return
     markup = Utils.generate_next_prev_keyboard(0,
                                                round(len(self.items) / 4))
     items_split = [
         self.items[i:i + 4] for i in range(0, len(self.items), 4)
     ]
     pages = list(map(Utils.make_page, items_split))
     self.pages = pages
     self.page = 0
     bot.edit_message_text(
         chat_id=self.message.chat.id,
         message_id=self.message.message_id,
         text=
         "In private chat you can see items from result of your request. "
         "Just type @EbayItemsBot and any text and see items from your result\n\n"
         + pages[0],
         parse_mode='html',
         disable_web_page_preview=True,
         reply_markup=markup)
Beispiel #2
0
 def changes_detector(self, call, text, markup):
     if not self.change:
         bot.edit_message_text(chat_id=call.message.chat.id,
                               message_id=call.message.message_id,
                               reply_markup=markup,
                               text=text)
     else:
         Utils.FUNCTIONS["Change"](call)
Beispiel #3
0
 def send(self, pages):
     self.__lock.acquire()
     self.__progress += (1 / pages * 100)
     bot.edit_message_text(chat_id=self.__message.chat.id,
                           message_id=self.__message.message_id,
                           text="Please, wait...\n"
                           "{}% is done".format(int(self.__progress)))
     self.__lock.release()
Beispiel #4
0
    def get_result(self):
        bot.edit_message_text(chat_id=self.message.chat.id,
                              message_id=self.message.message_id,
                              text="Please, wait...\n0% is done")

        helper = EbayApiHelper(self.keywords, self.sort, self.message)
        futures = helper.futures(Utils.PAGES)
        xmldocs = []
        for i in futures:
            xmldocs.append(minidom.parse(BytesIO(i.result())))
        parser = ResponseParser(xmldocs, self.rating, self.feedback, self.sort)
        self.items = parser.items
        bot.edit_message_text(chat_id=self.message.chat.id,
                              message_id=self.message.message_id,
                              text="DONE")