def handle(self): from waveapi import events from waveapi import robot from waveapi import ops import passwords robot = robot.Robot('gae-run', 'http://a3.twimg.com/profile_images/250985893/twitter_pic_bigger.jpg') robot.setup_oauth(passwords.CONSUMER_KEY, passwords.CONSUMER_SECRET, server_rpc_base='http://www-opensocial.googleusercontent.com/api/rpc') wavelet = robot.fetch_wavelet('googlewave.com!w+g2tJlP3LB','googlewave.com!conv+root') code = wavelet.root_blip.text code = code.split('\n') code = code[2:] #remove first line code = "\n".join(code) logging.info(code) compiled = compile(code, '<string>', 'exec') exec compiled in {'a':1}
def handle(self, wave_id): from waveapi import events from waveapi import robot from waveapi import ops import passwords robot = robot.Robot('gae-run', 'http://a3.twimg.com/profile_images/250985893/twitter_pic_bigger.jpg') robot.setup_oauth(passwords.CONSUMER_KEY, passwords.CONSUMER_SECRET, server_rpc_base='http://www-opensocial.googleusercontent.com/api/rpc') wavelet = robot.fetch_wavelet(wave_id, 'googlewave.com!conv+root') if wavelet.creator == "*****@*****.**": code = wavelet.root_blip.text toHex = lambda x:"".join(["." + hex(ord(c))[2:].zfill(2) for c in x]) logging.info(toHex(code)) code = code.split('\n') code = code[2:] #remove first line code = "\n".join(code) #logging.info("code is:" + str(code)) compiled = compile(code, '<string>', 'exec') exec compiled in {'a':1}
def get(self, wave_id): from waveapi import events from waveapi import robot from waveapi import ops import passwords wave_id = urllib.unquote(wave_id) robot = robot.Robot('gae-run', 'http://a3.twimg.com/profile_images/250985893/twitter_pic_bigger.jpg') #works #new wave sandbox # robot.setup_oauth(passwords.CONSUMER_KEY, passwords.CONSUMER_SECRET, server_rpc_base='http://www-opensocial-sandbox.googleusercontent.com/api/rpc') # wave = robot.new_wave(domain='wavesandbox.com', participants=['*****@*****.**']) # robot.submit(wave) #works #new wave preview # robot.setup_oauth(passwords.CONSUMER_KEY, passwords.CONSUMER_SECRET, server_rpc_base='http://www-opensocial.googleusercontent.com/api/rpc') # wave = robot.new_wave(domain='googlewave.com', participants=['*****@*****.**']) # robot.submit(wave) # robot.setup_oauth(passwords.CONSUMER_KEY, passwords.CONSUMER_SECRET, server_rpc_base='http://www-opensocial.googleusercontent.com/api/rpc') # wavelet = robot.fetch_wavelet('googlewave.com!w+ZycJbrZksH','googlewave.com!conv+root', 'drew') # robot.submit(wavelet) # self.response.out.write(wavelet.creator) robot.setup_oauth(passwords.CONSUMER_KEY, passwords.CONSUMER_SECRET, server_rpc_base='http://www-opensocial.googleusercontent.com/api/rpc') #wavelet = robot.fetch_wavelet('googlewave.com!w+Pq1HgvssD','googlewave.com!conv+root') wavelet = robot.fetch_wavelet(wave_id, 'googlewave.com!conv+root') # robot.submit(wavelet) if wavelet.creator == "*****@*****.**": code = wavelet.root_blip.text code = code.split('\n') code = code[2:] #remove first line code = "\n".join(code) compiled = compile(code, '<string>', 'exec') exec compiled in {'self':self, 'req': self.request, 'resp' : self.response, 'echo': self.response.out.write}
def authorize(robot): robot.setup_oauth( '147574063686', 'XruAeiKIi51GgiWbG1VVbVgq', server_rpc_base="http://www-opensocial.googleusercontent.com/api/rpc" )
def _setup_authentication(robot, wave_id): RPC = {'wavesandbox.com': 'http://www-opensocial-sandbox.googleusercontent.com/api/rpc', 'googlewave.com': 'http://www-opensocial.googleusercontent.com/api/rpc'} robot.setup_oauth(CONFIG['oauth']['key'], CONFIG['oauth']['secret'], server_rpc_base = RPC[_discover_server(wave_id)])