Created
August 26, 2010 07:59
-
-
Save xqms/551027 to your computer and use it in GitHub Desktop.
Generate a google session token for google calendar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Get a google AuthSub token for google calendar | |
Usage: just run and follow the instructions. | |
Author: Max Schwarz <[email protected]> | |
""" | |
import gdata | |
import gdata.calendar.service | |
import gdata.service | |
import gdata.calendar | |
import sys | |
from optparse import OptionParser | |
if __name__ == "__main__": | |
parser = OptionParser() | |
parser.add_option("--google-single-token", dest="token", help="Google Data API token") | |
options, args = parser.parse_args() | |
calendar_service = gdata.calendar.service.CalendarService() | |
calendar_service.ssl = True | |
if not options.token: | |
next = 'http://hoffentlichnichtda.de' | |
scope = 'https://www.google.com/calendar/feeds/' | |
secure = False | |
session = True | |
print "Go to:", calendar_service.GenerateAuthSubURL(next, scope, secure, session) | |
print "And set the returned token using --google-single-token" | |
exit(0) | |
options.token = options.token.replace("%2F", "/") | |
calendar_service.SetAuthSubToken(options.token) | |
calendar_service.UpgradeToSessionToken() | |
print "Your session token is:", str(calendar_service.GetAuthSubToken()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment