<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mod_python &#8211; blog.fukata.org</title>
	<atom:link href="/archives/tag/mod_python/feed/" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>旅するプログラマ</description>
	<lastBuildDate>Fri, 11 Aug 2017 22:59:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.6</generator>
	<item>
		<title>[Python]mod_python使用時のダウンロード処理</title>
		<link>/archives/1806/</link>
					<comments>/archives/1806/#respond</comments>
		
		<dc:creator><![CDATA[fukata]]></dc:creator>
		<pubDate>Tue, 20 Oct 2009 16:36:50 +0000</pubDate>
				<category><![CDATA[開発]]></category>
		<category><![CDATA[mod_python]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[ユーティリティ]]></category>
		<guid isPermaLink="false">http://fukata.org/?p=1806</guid>

					<description><![CDATA[現在、pythonを勉強中でちょっとしたWEBアプリを作っていたのですが、ダウンロード処理を書かないといけなくなったので、モジュールを作成してみました。よかったらどうぞ。 # -*- coding:  ... <a href="/archives/1806/"> 続きを読む</a>]]></description>
										<content:encoded><![CDATA[<p>現在、pythonを勉強中でちょっとしたWEBアプリを作っていたのですが、ダウンロード処理を書かないといけなくなったので、モジュールを作成してみました。よかったらどうぞ。</p>
<pre lang="Python" line="1">
# -*- coding: utf-8 -*-

import sys
import os

def download(req,filepath):

    req.content_type = 'application/octet-stream'
    req.headers_out['Content-Type'] = 'application/octet-stream'
    req.headers_out['Content-Disposition'] = "attachment; filename=\"" + os.path.basename(filepath)
    req.headers_out['Content-Length'] = str(os.path.getsize(filepath))
    req.headers_out['Expires'] = '0'
    req.headers_out['Cache-Control'] = 'must-revalidate, post-check=0,pre-check=0'
    req.headers_out['Pragma'] = 'private'

    if sys.platform == "win32":
        import msvcrt
        msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)

    return req.sendfile(filepath)
</pre>
]]></content:encoded>
					
					<wfw:commentRss>/archives/1806/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
