Created
May 30, 2011 00:05
-
-
Save EntityReborn/998266 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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