Exemplo n.º 1
0
 def search(self, event, offset=None):
     self.search_list = iter(
         Vkfunc.search_users(self.search_params, offset=offset))
     self.marked_list = db_func.marked_ids(event.user_id)
     try:
         self.pair_id, url = next(self.search_list)
         while self.pair_id in self.marked_list:
             self.pair_id, url = next(self.search_list)
         photos = ','.join([
             f'photo{self.pair_id}_{photo}'
             for photo in Vkfunc.get_photos(self.pair_id)
         ])
         return self.search_message(event, url, photos)
     except StopIteration:
         return Vkfunc.write_msg(
             event.user_id,
             f'По такому запросу никого не найдено 😔',
             kb.back_button())
Exemplo n.º 2
0
 def test_search_users(self):
     assert Vkfunc.search_users(
         {}, count=1, q='Павел Дуров') == [[1, 'https://vk.com/durov']]