Simple example of BaseHTTPServer use
Doug Fort
dougfort at downright.com
Thu Jun 14 18:33:11 EDT 2001
David Lees wrote:
> I would like to use the BaseHTTPServer class to handle a PUT and send
> back some http. I am sending the headers back correctly I think, but no
> data appears to be going back. I am probably using the wfile instance
> variable incorrectly. Here is sample code I am working on.
>
> def do_PUT(self):
> self.send_response(200,'<response></response>\n')
> self.send_header("Content-type", "text/html")
> self.wfile.write('junker goes\nout here\n')
> self.end_headers()
>
>
>
> Thanks in advance.
>
> David Lees
>
I believe you need to call end_headers() before attempting to send any
data. end_headers() writes a blank line which is followed by the data. I
recommend Frederik Lundh's book "Python Standard Library" from O'Reilly, it
has good clear examples and list lists at US$29.95 unlike the bloated $50
books that line the shelves.
--
Doug Fort <dougfort at downright.com>
Senior Meat Manager
Downright Software LLC
http://www.downright.com
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Seven Servers In California And Texas - The Worlds Uncensored News Source
More information about the Python-list
mailing list