device.py 418 Bytes
Newer Older
lcn's avatar
lcn committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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")