Drkcore

02 08 2010 Python Flask Tweet

FlaskでRSSを出力する

make_responseでresponseオブジェクトを作って、Content-Typeを設定する。

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    response = app.make_response(rss)
    response.headers['Content-Type'] = 'application/rss+xml'
    return response

if __name__ == "__main__":
    app.run()

RSSの生成には、ElementTreeを使うかエキスパートPythonプログラミングにあるようにテンプレートを使う。

ProductName エキスパートPythonプログラミング
Tarek Ziade
アスキー・メディアワークス / ¥ 3,780 ()
在庫あり。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021