<s> import asyncio <EOL> from aiohttp import wsgi <EOL> from irc3 import plugin <EOL> import json <EOL> @ plugin <EOL> class Webapp : <EOL> requires = [ '<STR_LIT>' ] <EOL> def __init__ ( self , bot ) : <EOL> def server ( ) : <EOL> return wsgi . WSGIServerHttpProtocol ( self . wsgi ) <EOL> self . bot = bot <EOL> loop = asyncio . get_event_loop ( ) <EOL> self . bot . log . info ( '<STR_LIT>' ) <EOL> asyncio . Task ( loop . create_server ( <EOL> server , '<STR_LIT:127.0.0.1>' , <NUM_LIT> ) ) <EOL> def wsgi ( self , environ , start_response ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , '<STR_LIT:application/json>' ) ] ) <EOL> plugin = self . bot . get_plugin ( '<STR_LIT>' ) <EOL> data = json . dumps ( list ( plugin . channels . keys ( ) ) ) <EOL> return [ data . encode ( '<STR_LIT:utf8>' ) ] </s>
