|
@@ -564,28 +564,3 @@ def downloadOTAInterface(request, fullPath, *callback_args, **callback_kwargs):
|
|
|
return res.json(444, 'fullPath')
|
|
|
|
|
|
|
|
|
-# 新ota包下载,上面的dvr被墙了
|
|
|
-@csrf_exempt
|
|
|
-def dlOTAInterface(request, fullPath, *callback_args, **callback_kwargs):
|
|
|
- res = ResponseObject()
|
|
|
- print('fullPath:')
|
|
|
- print(fullPath)
|
|
|
- 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')
|