Created
May 24, 2014 05:34
-
-
Save masazdream/ca567af3ad7e13e36acc to your computer and use it in GitHub Desktop.
はじめてのPython webapp2 認証機能
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
#codint: UTF-8 | |
from google.appengine.api import users | |
import webapp2 | |
class MainPage(webapp2.RequestHandler): | |
def get(self): | |
user = users.get_current_user() | |
if user: | |
self.response.headers['Content-Type'] = 'text/plain' | |
self.response.write('Hello,' + user.nickname()) | |
else: | |
self.redirect(users.create_login_url(self.request.uri)) | |
application = webapp2.WSGIApplication([ | |
('/', MainPage), | |
], debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment