This file contains 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
# reset the default encoding from ASCII to Unicode | |
# Note: it may not always work (depends on installations) | |
# see: http://blog.ianbicking.org/illusive-setdefaultencoding.html | |
import sys | |
reload(sys) # else the method will be missing | |
sys.setdefaultencoding('utf-8') | |
# convert from <type 'str'> to <type 'unicode'> | |
text.decode('utf-8') |
This file contains 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
class TwitterHandler(tornado.web.RequestHandler, | |
tornado.auth.TwitterMixin): | |
"""Handling Twitter authentication at URL http://www.yoursite.com/twitter""" | |
@tornado.web.asynchronous | |
def get(self): | |
if self.get_argument("oauth_token", None): | |
user = self.get_authenticated_user(self.async_callback(self._on_auth)) | |
return | |
self.authenticate_redirect() |
NewerOlder