使用Python瓶服务器接收来自Android的POST请求的FileEntity

2024-10-01 05:03:37 发布

您现在位置:Python中文网/ 问答频道 /正文

在Android手机上,我使用setEntity()将FileEntity放入POST请求。在

HttpPost post = new HttpPost(uri);
FileEntity reqEntity = new FileEntity(f, "application/x-gzip");
reqEntity.setContentType("binary/octet-stream");
reqEntity.setChunked(true);
post.addHeader("X-AethersNotebook-Custom", configuration.getCustomHeader());
post.setEntity(reqEntity);

使用瓶子时,尝试过这个,但它不起作用

^{pr2}$

内容将是空字符串。所以我试着看看请求.表单以及请求.files. 它们都没有键和值。在

request.files.keys()
request.forms.keys()

在搜索时,我读到了关于实体的信息:“一个请求可以转移实体”,并且实体有实体头和实体值。所以它可能类似于file content=e.get(实体头)。在


Tags: 实体newapplicationrequestfilesurikeyspost