如何在瓶子里发送xml/应用程序格式?[英] How to send xml/application format in bottle?

本文是小编为大家收集整理的关于如何在瓶子里发送xml/应用程序格式?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

如果有人来到我的URL假设/获取,则应在瓶子框架中回复XML/申请格式.我怎样才能做到这一点?我将Elementree用作XML发电机.

推荐答案

官方页面上进行cookie示例,这样做:

@route('/xml')
def xml():
    response.headers['Content-Type'] = 'xml/application'
    ....(create the xml here)......
    return xml_content_whatever

本文地址:https://www.itbaoku.cn/post/1975355.html

问题描述

If some one come to my url suppose /get it should give back a xml/application format in response in bottle framework. How can i do this? i am using elementree as xml generator.

推荐答案

Look on the official page for the cookie example and do it like this:

@route('/xml')
def xml():
    response.headers['Content-Type'] = 'xml/application'
    ....(create the xml here)......
    return xml_content_whatever