def CalendarTokenRequestUrl(redirect_path): """Constructs a calendar token request url. Args: redirect_path: The url that should be called back with the auth token. Returns: A string url that can be used to redirect the user to provide auth tokens to calendar. """ scopes = service.lookup_scopes('cl') domain = os.environ['AUTH_DOMAIN'] if domain.lower() == 'gmail.com': domain = 'default' token_request_url = auth.generate_auth_sub_url( redirect_path, scopes, secure=False, session=True, domain=domain ) return token_request_url
def setup_client(self, spreadsheet): try: from google.appengine.api import apiproxy_stub_map from google.appengine.api import urlfetch_stub apiproxy_stub_map.apiproxy.RegisterStub("urlfetch", urlfetch_stub.URLFetchServiceStub()) except: pass self.spreadsheet = spreadsheet self.client = gdata.spreadsheet.service.SpreadsheetsService() gdata.alt.appengine.run_on_appengine(self.client, store_tokens=False) self.token = AuthSubToken() self.token.set_token_string(self.token_string) self.token.scopes = lookup_scopes(self.client.service) self.client.current_token = self.token self.feed = self.client.GetSpreadsheetsFeed() self.id = GDataConnector.get_spreadsheet_id(self.feed, spreadsheet) self.worksheets = GDataConnector.get_worksheet_dictionary(self.client.GetWorksheetsFeed(self.id))