<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Python_Web_Server</id>
	<title>Python Web Server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Python_Web_Server"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Python_Web_Server&amp;action=history"/>
	<updated>2026-05-18T13:50:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Python_Web_Server&amp;diff=5232&amp;oldid=prev</id>
		<title>PeterHarding: Created page with &quot;=Simple=  &lt;pre&gt; # Python 3 server example from http.server import BaseHTTPRequestHandler, HTTPServer import time  hostName = &quot;localhost&quot; serverPort = 8080  class MyServer(Base...&quot;</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Python_Web_Server&amp;diff=5232&amp;oldid=prev"/>
		<updated>2022-02-06T21:12:41Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=Simple=  &amp;lt;pre&amp;gt; # Python 3 server example from http.server import BaseHTTPRequestHandler, HTTPServer import time  hostName = &amp;quot;localhost&amp;quot; serverPort = 8080  class MyServer(Base...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Simple=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Python 3 server example&lt;br /&gt;
from http.server import BaseHTTPRequestHandler, HTTPServer&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
hostName = &amp;quot;localhost&amp;quot;&lt;br /&gt;
serverPort = 8080&lt;br /&gt;
&lt;br /&gt;
class MyServer(BaseHTTPRequestHandler):&lt;br /&gt;
    def do_GET(self):&lt;br /&gt;
        self.send_response(200)&lt;br /&gt;
        self.send_header(&amp;quot;Content-type&amp;quot;, &amp;quot;text/html&amp;quot;)&lt;br /&gt;
        self.end_headers()&lt;br /&gt;
        self.wfile.write(bytes(&amp;quot;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;https://pythonbasics.org&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;quot;, &amp;quot;utf-8&amp;quot;))&lt;br /&gt;
        self.wfile.write(bytes(&amp;quot;&amp;lt;p&amp;gt;Request: %s&amp;lt;/p&amp;gt;&amp;quot; % self.path, &amp;quot;utf-8&amp;quot;))&lt;br /&gt;
        self.wfile.write(bytes(&amp;quot;&amp;lt;body&amp;gt;&amp;quot;, &amp;quot;utf-8&amp;quot;))&lt;br /&gt;
        self.wfile.write(bytes(&amp;quot;&amp;lt;p&amp;gt;This is an example web server.&amp;lt;/p&amp;gt;&amp;quot;, &amp;quot;utf-8&amp;quot;))&lt;br /&gt;
        self.wfile.write(bytes(&amp;quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;, &amp;quot;utf-8&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:        &lt;br /&gt;
    webServer = HTTPServer((hostName, serverPort), MyServer)&lt;br /&gt;
    print(&amp;quot;Server started http://%s:%s&amp;quot; % (hostName, serverPort))&lt;br /&gt;
&lt;br /&gt;
    try:&lt;br /&gt;
        webServer.serve_forever()&lt;br /&gt;
    except KeyboardInterrupt:&lt;br /&gt;
        pass&lt;br /&gt;
&lt;br /&gt;
    webServer.server_close()&lt;br /&gt;
    print(&amp;quot;Server stopped.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Flask=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>