|
Dustin Mitchell
dustin at ywlcs.org
Sat Jun 7 14:14:19 EST 2003
On Sat, Jun 07, 2003 at 05:27:49PM +0200, martin voigt wrote:
> hi *,
>
> how do i use a content handler to send binary data to the client? the write method supports only strings.
Python holds arbitrary binary data in strings. So you can do, e.g.,
data = open("my.gif", "r").read()
req.content_type = 'image/gif'
req.send_http_header()
req.write(data)
Dustin
--
Dustin Mitchell
dustin at ywlcs.org/djmitche at alumni.uchicago.edu
http://people.cs.uchicago.edu/~dustin/
|