import os

from pot_libs.logger import log
from unify_api import constants


async def get_download(request):
    """装置升级"""
    file_path = os.path.expanduser(constants.DEVICE_UPGRADED_FILE)
    print(file_path)
    if os.path.exists(file_path):
        with open(file_path, 'rb') as fh:
            # 浏览器响应视为文件附件
            return fh.read()
    log.error("请正确放置upgrade.bin")
