Commit 36e70fd9 authored by lvshibao's avatar lvshibao

录音文件下载的代理

parent 9d355ce3
File added
......@@ -23,6 +23,7 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('api/v1/', include('inspect_report.urls_api_v1')),
path('view/page/', include('inspect_report.urls')),
path('proxy/', include('inspect_report.proxies')),
path('api/auth/', include('rest_framework.urls')),
path('api/docs/', include_docs_urls(title='inspect_reportAPI', public=False)),
path('api/auth-jwt/', obtain_jwt_token), # POST email=email&password=password
......
from django.urls import path
from inspect_report.utils.mp3_proxy import mp3_proxy
urlpatterns = [
# path('admin/', admin.site.urls),
path('mp3/', mp3_proxy)
]
import requests
from django.http import HttpResponse
def mp3_proxy(request):
src = request.GET.get('mp3_src')
resp = requests.get(src)
# with open('./1.txt', 'wb') as f:
# f.write(resp.content)
return HttpResponse(resp.content, content_type="audio/mpeg")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment