#!/usr/bin/python import authlib ACCOUNT_EMAIL= '*****@*****.**' ACCOUNT_PASS = "******" C2DM_ID = "APA91bG_wjhPPoM1SHfNWE-yWs2sUCiHEv0osbDx2xv1hlayuu6hS6iW3gqb_MT9ISAof1uRAypQQ2B55zMoJVzp6omEPs7RYwpGoXpA9bnuQ_b4VVI0q2wVRV3X1S_CR9qRw6hhtfAJ" c2dmtoken = authlib.get_google_authtoken("androidfiledrop", "ac2dm", ACCOUNT_EMAIL, ACCOUNT_PASS) print c2dmtoken #uncomment to send c2dm message #print authlib.testC2DM(c2dmtoken, C2DM_ID, "something")
#This script updates the stored token for the C2DM notification user #run this with the first arg as the account password to update the token import urllib import sys import authlib token = authlib.get_google_authtoken("androidfiledrop", "ac2dm", "*****@*****.**", sys.argv[1]) print "c2dmtoken is: " + token afdConn = authlib.AppEngineClient("androidfiledrop", "*****@*****.**", sys.argv[1]) print "appengine token is: " + afdConn.ahToken opener = authlib.get_opener() opener.addheaders.append(('Cookie', afdConn.ahToken)) data = {} data['token'] = token params = urllib.urlencode(data) url = "https://androidfiledrop.appspot.com/admin/updatetoken" f = opener.open(url, params) print f