comparison example/persona.py @ 36:afeb01315ab6

example/persona.py
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 27 Dec 2013 13:49:48 -0800
parents d95ac066cb62
children
comparison
equal deleted inserted replaced
35:d95ac066cb62 36:afeb01315ab6
4 test Mozilla persona auth 4 test Mozilla persona auth
5 5
6 https://login.persona.org/about 6 https://login.persona.org/about
7 """ 7 """
8 8
9 import browserid
9 import optparse 10 import optparse
10 import os 11 import os
11 import sys 12 import sys
12 from webob import Request, Response, exc 13 from webob import Request, Response, exc
13 from wsgiref import simple_server 14 from wsgiref import simple_server
26 if method == 'GET': 27 if method == 'GET':
27 content_type = 'text/html' 28 content_type = 'text/html'
28 body = self.page 29 body = self.page
29 elif method == 'POST': 30 elif method == 'POST':
30 content_type = 'text/plain' 31 content_type = 'text/plain'
32 assertion = request.POST.get('assertion')
33 print ("Assertion: %s" % assertion)
31 body = '\n'.join(['%s: %s' % (key, environ[key]) 34 body = '\n'.join(['%s: %s' % (key, environ[key])
32 for key in sorted(environ.keys())]) 35 for key in sorted(environ.keys())])
33 else: 36 else:
34 content_type = 'text/plain' 37 content_type = 'text/plain'
35 body = 'Try GET or POST to do something interesting (How did you get here?)' 38 body = 'Try GET or POST to do something interesting (How did you get here?)'