<s> import liveandletdie <EOL> from pyramid . config import Configurator <EOL> from pyramid . response import Response <EOL> from wsgiref . simple_server import make_server <EOL> from authomatic import Authomatic <EOL> from authomatic . adapters import WebObAdapter <EOL> from tests . functional_tests import fixtures <EOL> authomatic = Authomatic ( fixtures . ASSEMBLED_CONFIG , '<STR_LIT>' , report_errors = False ) <EOL> def home ( request ) : <EOL> return Response ( fixtures . render_home ( '<STR_LIT>' ) ) <EOL> def login ( request ) : <EOL> provider_name = request . matchdict . get ( '<STR_LIT>' ) <EOL> response = Response ( ) <EOL> result = authomatic . login ( WebObAdapter ( request , response ) , provider_name ) <EOL> if result : <EOL> response . write ( fixtures . render_login_result ( '<STR_LIT>' , result ) . encode ( ) ) <EOL> return response <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> config = Configurator ( ) <EOL> config . add_route ( '<STR_LIT>' , '<STR_LIT:/>' ) <EOL> config . add_view ( home , route_name = '<STR_LIT>' ) <EOL> config . add_route ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> config . add_view ( login , route_name = '<STR_LIT>' ) <EOL> app = config . make_wsgi_app ( ) <EOL> liveandletdie . WsgirefSimpleServer . wrap ( app ) <EOL> server = make_server ( '<STR_LIT:127.0.0.1>' , <NUM_LIT> , app ) <EOL> server . serve_forever ( ) </s>
