def interactive_authorize(self, consumer, app, **kwargs):
        from textwrap import fill

        # Suppress batchhttp.client's no-log-handler warning.
        class NullHandler(logging.Handler):
            def emit(self, record):
                pass
        logging.getLogger().addHandler(NullHandler())

        if not isinstance(consumer, oauth.OAuthConsumer):
            consumer = oauth.OAuthConsumer(*consumer)
        if not isinstance(app, typepad.Application):
            app = typepad.Application.get_by_id(app)

        # Set up an oauth client for our signed requestses.
        oauth_client = OAuthClient(consumer, None)
        oauth_client.request_token_url = app.oauth_request_token_url
        oauth_client.access_token_url = app.oauth_access_token_url
        oauth_client.authorization_url = app.oauth_authorization_url

        # Get a request token for the viewer to interactively authorize.
        request_token = oauth_client.fetch_request_token(None)
        log.debug("Got request token %r", request_token)

        # Ask the viewer to authorize it.
        approve_url = oauth_client.authorize_token(params=kwargs)
        log.debug("Asking viewer to authorize token with URL %r", approve_url)
        print fill("""To join your application %r, follow this link and click "Allow":"""
            % app.name, width=78)
        print
        print "<%s>" % approve_url
        print

        try:
            verifier = raw_input('Enter the verifier code TypePad gave you: ')
        except __HOLE__:
            print
            return

        # Exchange the authorized request token for an access token.
        access_token = oauth_client.fetch_access_token(verifier=verifier)

        # Re-authorize ourselves using that access token, so we can make authenticated requests with it.
        domain = urlparse.urlsplit(self.endpoint)[1]
        self.add_credentials(consumer, access_token, domain=domain)

        # Make sure the key works.
        typepad.client.batch_request()
        user = typepad.User.get_self()
        typepad.client.complete_batch()

        # Yay! Give the access token to the viewer for their reference.
        print
        print fill("""Yay! This new access token authorizes this typepad.client to act as %s (%s). Here's the token:"""
            % (user.display_name, user.url_id), width=78)
        print """
    Key:    %s
    Secret: %s
""" % (access_token.key, access_token.secret)
        print fill("""Pass this access token to typepad.client.add_credentials() to re-authorize as %s later."""
            % user.display_name, width=78)
        print

        return access_token
dataset/ETHPy150Open typepad/python-typepad-api/typepad/tpclient.py/OAuthHttp.interactive_authorize