Skip to content

Instantly share code, notes, and snippets.

@markpasc
Created July 28, 2010 00:30
Show Gist options
  • Save markpasc/493113 to your computer and use it in GitHub Desktop.
Save markpasc/493113 to your computer and use it in GitHub Desktop.
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