def send(self, response_decoder=None):
        """
        Creates and sends a request to the OAuth server, decodes the response
        and returns the resulting token object.

            response_decoder - A custom callable can be supplied to override
              the default method of extracting AccessToken parameters from the
              response. This is necessary for server implementations which do
              not conform to the more recent OAuth2 specification
              (ex: Facebook). By default, this will assume the response is
              encoded using JSON. The callable should return a dictionary with
              keys and values as follows:

                access_token - The access token

                token_type - The token type

                expires_in - The number of seconds in which the token expires

                refresh_token - The refresh token

                scope - The permission scope (as a space delimited string)
        """
        decoder = loads
        if response_decoder is not None and callable(response_decoder):
            decoder = response_decoder

        request = self.build_url_request()
        try:
            f = urlopen(request)
        except __HOLE__ as e:
            try:
                error_resp = e.read()
                error_data = loads(error_resp)
            except Exception:
                raise AccessTokenResponseError('Access request returned an error, but the response could not be read: %s ' % error_resp)

            if error_data.get('error') is None:
                raise AccessTokenResponseError('Access request returned an error, but did not include an error code')

            raise AccessTokenRequestError(error_data['error'], error_data.get('error_description'), error_data.get('error_uri'))
        token_data = decoder(f.read())
        return self._create_access_token(token_data)
dataset/ETHPy150Open ryanhorn/tyoiOAuth2/tyoi/oauth2/__init__.py/AccessTokenRequest.send