简体   繁体   English

简单的Python服务器程序通过Postman的http POST接收图像?

[英]Simple Python server program to receive an image via http POST from Postman?

Does anybody know of an example Python script to receive an image sent via http POST from Postman? 有没有人知道一个示例Python脚本来接收从Postman通过http POST发送的图像? I'd like to write a simple Python server script that could receive an image sent like this: 我想写一个简单的Python服务器脚本,可以接收这样发送的图像:

在此输入图像描述

I'm 100% flexible on how the image is sent from Postman, for example I could use "form-data", then specify key/value/file, or use "binary". 我对Postman发送图像的方式100%灵活,例如我可以使用“表单数据”,然后指定键/值/文件,或使用“二进制”。 Either way I'm looking for the Python server script to receive the file and either save it (to the same location as the Python server script, or a different location, does not really matter) or display it, either way to prove out that the server did receive the image. 无论哪种方式,我都在寻找Python服务器脚本来接收文件并将其保存(与Python服务器脚本相同的位置,或者不同的位置,并不重要)或显示它,无论哪种方式证明服务器确实收到了图像。

Unfortunately all the Python server examples I can find send stuff rather than receive. 不幸的是,我可以找到所有Python服务器示例发送内容而不是接收。 Can anybody provide some assistance? 有人可以提供一些帮助吗?

这是一个很好的例子,它使用内置的BaseHTTPServer包在python中接收GET / POST请求: http ://joelinoff.com/blog/?p = 1658

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM