def build_xoauth_string(url, consumer, token=None):
 request = Request.from_consumer_and_token(consumer, token, 'GET', url)
 signing_method = SignatureMethod_HMAC_SHA1()
 request.sign_request(signing_method, consumer, token)
 params = []
 for (k, v) in sorted(request.iteritems()):
  if (v is not None):
   params.append(('%s="%s"' % (k, escape(v))))
 return ('%s %s %s' % ('GET', url, ','.join(params)))

def build_xoauth_string ( url , consumer , token = None ) : request = Request . from_consumer_and_token ( consumer , token , 'GET' , url ) signing_method = SignatureMethod_HMAC_SHA1 ( ) request . sign_request ( signing_method , consumer , token ) params = [ ] for ( k , v ) in sorted ( request . iteritems ( ) ) : if ( v is not None ) : params . append ( ( '%s="%s"' % ( k , escape ( v ) ) ) ) return ( '%s %s %s' % ( 'GET' , url , ',' . join ( params ) ) )
build an xoauth string for use in smtp/impa authentication .