Skip to content

Instantly share code, notes, and snippets.

@EntityReborn
Created May 30, 2011 00:05
Show Gist options
  • Save EntityReborn/998266 to your computer and use it in GitHub Desktop.
Save EntityReborn/998266 to your computer and use it in GitHub Desktop.
from socbot.pluginbase import Base
from twisted.application import internet, service
from twisted.web import resource, server
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
return "<html>Hello, world!</html>"
class Plugin(Base):
def initialize(self, *args, **kwargs):
site = server.Site(Simple())
self.server = internet.TCPServer(8080, site)
self.server.startService()
def disabling(self, *args, **kwargs):
self.server.stopService()
def enabled(self, *args, **kwargs):
try:
self.server.startService()
except Exception, e:
print e
def beforeReload(self, *args, **kwargs):
self.disabling(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment