如何使用Postman将图像发送到烧瓶服务器

时间:2018-02-04 10:41:09

标签: python postman flask-restful

我需要使用Postman将图像文件发送到烧瓶服务器。我确实使用网络浏览器和“渲染模板”发送它。但是当我和邮递员一起尝试相同的程序时,它显示end = dt.datetime.today() start = End - dt.timedelta(days=1) sql = "SELECT [Col1],[Col2] FROM [Data] WHERE [date] BETWEEN '{}' AND '{}'".format(start, end) cursor.execute(sql) rows = cursor.fetchall()

Postman 405

我也试过/上传,但它说"method not allowed"

Postman 400

2 个答案:

答案 0 :(得分:4)

为了完成这项工作,你需要这个:

  • 在邮递员的网址中添加上传
  • 添加标题Content-Type multipart / form-dataitem
  • 在您选择文件的表单数据中输入文件作为行的键。在屏幕截图中,我看到它是空的。

答案 1 :(得分:0)

要在邮递员上运行代码,您需要进行一些更改
标题部分中,更改

-“ content-type”:“ multipart / form-data”

enter image description here

然后在正文部分中选择
“ form-data”:并选择文件

enter image description here