Created
July 28, 2010 00:30
-
-
Save markpasc/493113 to your computer and use it in GitHub Desktop.
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
import urlparse | |
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp import util | |
from oauth.oauth import OAuthToken, OAuthConsumer | |
import typepad | |
class MainHandler(webapp.RequestHandler): | |
def get(self): | |
access_token = OAuthToken.from_string( | |
'oauth_token_secret=sec&oauth_token=tok') | |
consumer = OAuthConsumer('CONSUMER KEY', 'CONSUMER SECRET') | |
domain = urlparse.urlsplit(typepad.client.endpoint)[1] | |
typepad.client.add_credentials(consumer, access_token, domain=domain) | |
typepad.client.batch_request() | |
user = typepad.User.get_self() | |
typepad.client.complete_batch() | |
self.response.out.write('%s (%s)' % (user.display_name, user.url_id)) | |
def main(): | |
application = webapp.WSGIApplication([('/', MainHandler)], | |
debug=True) | |
util.run_wsgi_app(application) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment