# Path: modules/utils/data.py
# def prepare_binary_from_url(url, verify=True):
#     try:
#         content = requests.get(url, timeout=(1, 3), verify=verify).content
#     except RequestException:
#         pass
#     else:
#         return BytesIO(content)


import re
import requests
import json
from modules.utils.data import prepare_binary_from_url
            set(re.findall("/files/thumb/.*?.jpg", response.content.decode('utf-8'))))
        matricies = list(
            map(lambda x: 'https://picachoo.ru{}'.format(x.replace('/thumb', '')), matricies))
        bot.store.set('picachoo_matricies', json.dumps(matricies))
        curr_page += 1
        curr_index = 0

    if not user_page is None and not user_index is None:
        curr_index = user_index % len(matricies)

    try:
        matrix = matricies[curr_index]
    except IndexError:
        return 'Page not found'

    ext = matrix.split('.')[2]
    chat_id = kwargs.pop('chat_id')

    bot.pre_send(chat_id=chat_id, action='upload_photo')

    if user_page is None and user_index is None:
        bot.store.set('picachoo_index', curr_index + 1)
        bot.store.set('picachoo_page', curr_page)

    bot.call(
        'sendPhoto',
        'POST',
        data={'chat_id': chat_id},
        files={'photo': (
            'file.{}'.format(ext),

# Path: modules/utils/data.py
# def prepare_binary_from_url(url, verify=True):
#     try:
#         content = requests.get(url, timeout=(1, 3), verify=verify).content
#     except RequestException:
#         pass
#     else:
#         return BytesIO(content)


# Path: modules/user_picachoo.py
import re
import requests
import json
from modules.utils.data import prepare_binary_from_url

            set(re.findall("/files/thumb/.*?.jpg", response.content.decode('utf-8'))))
        matricies = list(
            map(lambda x: 'https://picachoo.ru{}'.format(x.replace('/thumb', '')), matricies))
        bot.store.set('picachoo_matricies', json.dumps(matricies))
        curr_page += 1
        curr_index = 0

    if not user_page is None and not user_index is None:
        curr_index = user_index % len(matricies)

    try:
        matrix = matricies[curr_index]
    except IndexError:
        return 'Page not found'

    ext = matrix.split('.')[2]
    chat_id = kwargs.pop('chat_id')

    bot.pre_send(chat_id=chat_id, action='upload_photo')

    if user_page is None and user_index is None:
        bot.store.set('picachoo_index', curr_index + 1)
        bot.store.set('picachoo_page', curr_page)

    bot.call(
        'sendPhoto',
        'POST',
        data={'chat_id': chat_id},
        files={'photo': (
            'file.{}'.format(ext),

            prepare_binary_from_url(matrix, verify=False),