<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Local execution of Python CGI scripts</title>
	<atom:link href="http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/</link>
	<description>Eli Bendersky's personal website</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:22:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: damjan</title>
		<link>http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/comment-page-1/#comment-130493</link>
		<dc:creator>damjan</dc:creator>
		<pubDate>Fri, 12 Sep 2008 20:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/#comment-130493</guid>
		<description>And if you use Linux + KDE, konqueror can run CGI scripts too :)</description>
		<content:encoded><![CDATA[<p>And if you use Linux + KDE, konqueror can run CGI scripts too <img src='http://eli.thegreenplace.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/comment-page-1/#comment-130172</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Tue, 09 Sep 2008 17:42:45 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/#comment-130172</guid>
		<description>Interesting. Thanks, Vasudev.</description>
		<content:encoded><![CDATA[<p>Interesting. Thanks, Vasudev.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vasudev Ram</title>
		<link>http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/comment-page-1/#comment-130165</link>
		<dc:creator>Vasudev Ram</dc:creator>
		<pubDate>Tue, 09 Sep 2008 16:22:41 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/09/06/local-execution-of-python-cgi-scripts/#comment-130165</guid>
		<description>Neat, Eli.

Something roughly along the same lines, but using only BaseHTTPServer, is to do &#039;servlets&#039; (like Java servlets) in Python (also works in Ruby with Mongrel or WEBrick), something like this:

[ This is a pretty powerful technique that allows you to get a programmable web server with minimal code overhead. ]

Write a class with a method you want called over HTTP from a web client. (The client could be written in Python, Ruby or almost any other language that can do HTTP calls programmatically.)

Create an instance of BaseHTTPServer.

Mount your class on the server (this is similar to registering functions or classes with an XML-RPC server when using XML-RPC - though the method I describe is not using XML-RPC), configuring it to be callable at a particular URL on the server. the way XML-RPC-enabled code can typically be called at http://hostname/RPC2.

Start the server (the same .serve_forever() call as you used in your CGI code above.

And of course, multiple classes with multiple methods can be mounted this way, on the same instance of BaseHTTPServer, as long as they are referenced at different paths, and can be called at different times during the same session.

For a more detailed description about the &#039;servlets&#039; approach, see here: a reply I wrote to a question on comp.lang.ruby - but it applies to Python too - the poster was asking about the same topic:

http://groups.google.com/group/ruby-talk-google/browse_thread/thread/29514a637cbf7cf3/c1330727c370bfe0?lnk=st&amp;q=%2BVasudev+%2Bwriting+a+web+service#c1330727c370bfe0

- Vasudev</description>
		<content:encoded><![CDATA[<p>Neat, Eli.</p>
<p>Something roughly along the same lines, but using only BaseHTTPServer, is to do &#8217;servlets&#8217; (like Java servlets) in Python (also works in Ruby with Mongrel or WEBrick), something like this:</p>
<p>[ This is a pretty powerful technique that allows you to get a programmable web server with minimal code overhead. ]</p>
<p>Write a class with a method you want called over HTTP from a web client. (The client could be written in Python, Ruby or almost any other language that can do HTTP calls programmatically.)</p>
<p>Create an instance of BaseHTTPServer.</p>
<p>Mount your class on the server (this is similar to registering functions or classes with an XML-RPC server when using XML-RPC &#8211; though the method I describe is not using XML-RPC), configuring it to be callable at a particular URL on the server. the way XML-RPC-enabled code can typically be called at <a href="http://hostname/RPC2" rel="nofollow">http://hostname/RPC2</a>.</p>
<p>Start the server (the same .serve_forever() call as you used in your CGI code above.</p>
<p>And of course, multiple classes with multiple methods can be mounted this way, on the same instance of BaseHTTPServer, as long as they are referenced at different paths, and can be called at different times during the same session.</p>
<p>For a more detailed description about the &#8217;servlets&#8217; approach, see here: a reply I wrote to a question on comp.lang.ruby &#8211; but it applies to Python too &#8211; the poster was asking about the same topic:</p>
<p><a href="http://groups.google.com/group/ruby-talk-google/browse_thread/thread/29514a637cbf7cf3/c1330727c370bfe0?lnk=st&amp;q=%2BVasudev+%2Bwriting+a+web+service#c1330727c370bfe0" rel="nofollow">http://groups.google.com/group/ruby-talk-google/browse_thread/thread/29514a637cbf7cf3/c1330727c370bfe0?lnk=st&amp;q=%2BVasudev+%2Bwriting+a+web+service#c1330727c370bfe0</a></p>
<p>- Vasudev</p>
]]></content:encoded>
	</item>
</channel>
</rss>
