def signing_base(self, request, consumer, token): """ This method generates the OAuth signature. It's defined here to avoid circular imports. """ sig = ( escape(request.method), escape(OAuthHook.get_normalized_url(request.url)), escape(OAuthHook.get_normalized_parameters(request)), ) key = '%s&' % escape(consumer.secret) if token is not None: key += escape(token.secret) raw = '&'.join(sig) return key, raw