gpt4 book ai didi

python - Falcon 框架响应对象 : resp. 媒体与 resp.body

转载 作者:行者123 更新时间:2023-12-01 01:23:00 27 4
gpt4 key购买 nike

我无法理解响应方法:resp.media 和 resp.body 之间的主要区别和相似之处。是否有关于使用其中一种而不是另一种的指导原则?

最佳答案

According to official documentation:

media

object – Returns a deserialized form of the request stream. When called, it will attempt to deserialize the request stream using the Content-Type header as well as the media-type handlers configured via falcon.RequestOptions.

body

body str or unicode – String representing response content.

If set to a Unicode type (unicode in Python 2, or str in Python 3), Falcon will encode the text as UTF-8 in the response. If the content is already a byte string, use the data attribute instead (it’s faster).

关于python - Falcon 框架响应对象 : resp. 媒体与 resp.body,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53626210/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com