|
@@ -563,4 +563,30 @@ def downloadOTAInterface(request, fullPath, *callback_args, **callback_kwargs):
|
|
|
else:
|
|
|
return res.json(444, 'fullPath')
|
|
|
|
|
|
+# ota包下载
|
|
|
+@csrf_exempt
|
|
|
+def ddlOTAInterface(request, *callback_args, **callback_kwargs):
|
|
|
+ res = ResponseObject()
|
|
|
+ print('fullPath:')
|
|
|
+ fullPath = 'static/otapack/DVR/en/V1.6.1.21AX1610010480000600000280001A.tar.gz'
|
|
|
+ if fullPath:
|
|
|
+ if os.path.isfile(fullPath):
|
|
|
+ try:
|
|
|
+ wrapper = FileWrapper(open(fullPath, 'rb'))
|
|
|
+ response = HttpResponse(wrapper, content_type="application/octet-stream")
|
|
|
+ response['Content-Length'] = os.path.getsize(fullPath)
|
|
|
+ response['Content-Disposition'] = 'attachment; filename=%s' % os.path.basename(fullPath)
|
|
|
+ response['Content-MD5'] = getMD5orSHA265(fullPath)
|
|
|
+ # 校验文件md5值
|
|
|
+ response['Content-SHA265'] = getMD5orSHA265(fullPath, 'SHA265')
|
|
|
+ response['Content-CRC32'] = getMD5orSHA265(fullPath, 'CRC32')
|
|
|
+ response['Content-Error'] = res.formal(0)
|
|
|
+ return response
|
|
|
+ except Exception as e:
|
|
|
+ return res.json(906, repr(e))
|
|
|
+ else:
|
|
|
+ return res.json(907)
|
|
|
+ else:
|
|
|
+ return res.json(444, 'fullPath')
|
|
|
+
|
|
|
|