Commits

Oscar Campos  committed 315b4c2

Initial Commit

  • Participants

Comments (0)

Files changed (1)

File webservice.py

+# -*- encode: utf-8 -*-
+#!/usr/bin/env python
+
+from twisted.web import server, resource
+from twisted.internet import reactor
+
+class HelloResource(resource.Resource):
+    isLeaf = True
+    numberRequests = 0
+    
+    def render_GET(self, request):
+        self.numberRequests += 1
+        request.setHeader("content-type", "text/plain")
+        return "I am request #" + str(self.numberRequests) + "\n"
+
+reactor.listenTCP(8080, server.Site(HelloResource()))
+reactor.run()