def getDocsClient(self): access_token = self.getAccessToken() if access_token is None: return None assert isinstance(access_token, OAuthHmacToken) docs_client = DocsClient() docs_client.auth_token = access_token return docs_client
def two_legged(request): requestor_id = request.GET.get("user") if not requestor_id: requestor_id = request.session.get("openid_data", {}).get("email") if not requestor_id: return render(request, "core/two_legged_error.html", {"error": "Requestor Id is not defined"}) client = DocsClient(source=settings.USER_AGENT) client.auth_token = TwoLeggedOAuthHmacToken(settings.CONSUMER_KEY, settings.CONSUMER_SECRET, requestor_id) try: documents = client.get_all_resources() except Unauthorized, e: return render(request, "core/two_legged_error.html", {"error": e})
def getDocsClient(): client = DocsClient(source='odenkiapi') access_token = loadAccessToken() if access_token is not None: client.auth_token = access_token return client
def oauth_gdocs(request, access_token): client = DocsClient(source=settings.USER_AGENT) client.auth_token = access_token documents = client.get_all_resources() return render(request, "core/oauth_gdocs.html", {"documents": documents})