嗨所以我在 django 视图中有这种方法可以将文件发布到不同的服务器。我收到一个 HTTP 415 错误,抱怨请求的媒体类型。我已经调试了请求并将其内容复制并粘贴到 fiddler 中。当我从提琴手发布相同的内容时,它起作用了。所以我不明白为什么它不能使用 python requests 包工作。
谁能帮我这个?
谢谢。
def upload(request):
if request.method == 'POST':
url=settings.WEBSERVICES_URL+'validate'
r = requests.post('http://localhost:9090/validate',data=request)
r2 = requests.get('http://localhost:9090/test')
return render_to_response("upload.html", context_instance=RequestContext(request))
else:
return render_to_response("upload.html", context_instance=RequestContext(request))