Logo Search packages:      
Sourcecode: ubuntu-sso-client version File versions  Download package

def ubuntu_sso::auth::AuthorisationClient::make_token_request (   self,
  oauth_request 
)

Perform the given `OAuthRequest` and return the associated token.

Definition at line 232 of file auth.py.

00232                                                :
        """Perform the given `OAuthRequest` and return the associated token."""
        
        logger.debug("Making a token request")
        # Note that we monkeypatched httplib above to handle invalid certs
        # Ways this urlopen can fail:
        # bad certificate
        #    raises IOError, e.args[1] == SSLError, e.args[1].errno == 1
        # No such server 
        #    raises IOError, e.args[1] == SSLError, e.args[1].errno == -2
        try:
            opener = FancyURLOpenerWithRedirectedPOST()
            fp = opener.open(oauth_request.http_url, oauth_request.to_postdata())
            data = fp.read()
        except IOError, e:
            self._forward_error_callback(e)
            return
        
        # we deliberately trap anything that might go wrong when parsing the
        # token, because we do not want this to explicitly fail
        # pylint: disable-msg=W0702
        try:
            out_token = oauth.OAuthToken.from_string(data)
            logger.debug("Token successfully requested")
            return out_token
        except:
            error = Exception(data)
            logger.error("Token was not successfully retrieved: data was '%s'",
               str(error))
            self._forward_error_callback(error)

    def open_in_browser(self, url):


Generated by  Doxygen 1.6.0   Back to index