def get(self): logging.info("Starting to load tasks %s" % datetime.datetime.now()) ret = '' gp_pub = RsaKey.gql("WHERE name = :1", 'gp_pub').get() gae_priv = RsaKey.gql("WHERE name = :1", 'gae_priv').get() gp_pubkey = self.makePubKey(gp_pub.keystring) gae_privkey = self.makePrivKey(gae_priv.keystring) users = Account.gql('WHERE active = :1', True) count = 0 for user in users: #logging.info(user.user) try: ret = '%s!gp!%s!gp!%s' % (user.user, user.gPass, user.twitter) gae_one = rsa.encrypt(str(ret), gp_pubkey) #logging.debug("WTF %s" % ret) send_key = gae_one.replace('\n', '!gp!') taskqueue.add(url='/worker/', params={'key': send_key}) #logging.error("KEY !%s!" % gae_one.replace('\n', '!gp!')) #logging.error("KEY !%d!" % gae_one.find('\n')) logging.debug("USER: %s TWITTER: %s KEY: %s" % (user.user, user.twitter, send_key)) count += 1 except: logging.error("something is f****d with USER: %s TWITTER: %s" % (user.user, user.twitter)) logging.info("Ended load tasks (%d users) %s" % (count, datetime.datetime.now()))
def get(self): gp_pub = RsaKey.gql("WHERE name = :1", 'gp_pub').get() gae_priv = RsaKey.gql("WHERE name = :1", 'gae_priv').get() gp_pubkey = self.makePubKey(gp_pub.keystring) gae_privkey = self.makePrivKey(gae_priv.keystring) ret = '' users = Account.gql('WHERE active = :1 ', True) for user in users: ret = ret + '%s!gp!%s!gp!%s!GP!' % (user.user, user.gPass, user.twitter) gae_one = rsa.encrypt(str(ret), gp_pubkey) self.generate('list.html', template_values={'users': gae_one})
def encryptGtalk(self, email, password, msg): gp_pub = RsaKey.gql("WHERE name = :1", 'gp_pub').get() gae_priv = RsaKey.gql("WHERE name = :1", 'gae_priv').get() gpowered_gtalk_url = 'http://gpowered.net/g/gtalk/update/%s/' enc = '%s!gpowered!%s!gpowered!%s' % (email, password, msg) gp_pubkey = self.makePubKey(gp_pub.keystring) gae_privkey = self.makePrivKey(gae_priv.keystring) gae_one = rsa.encrypt(str(enc), gp_pubkey) #gae_two = rsa.sign(gae_one, gae_privkey) encrypted_url = gpowered_gtalk_url % gae_one.replace('/', '!GP!') return encrypted_url
def get(self): k = RsaKey(name='fpp',keystring='sdasds') k.put()