• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python appengine_robot_runner.run函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中waveapi.appengine_robot_runner.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: create_robot

def create_robot(run=True, domain=None):
    robot = Robot(constants.ROBOT_NAME.title(), image_url=constants.ROBOT_IMG,
                  profile_url=constants.ROBOT_BASE_URL)

    robot.register_handler(events.WaveletSelfAdded, on_wavelet_self_added, context=[ events.Context.ROOT ])
    robot.register_handler(events.WaveletSelfRemoved, on_wavelet_self_removed, context=[ events.Context.ROOT ])

    robot.register_handler(events.WaveletParticipantsChanged, on_wavelet_participants_changed, context=[ events.Context.ROOT ])

    robot.register_handler(events.BlipSubmitted, on_blip_submitted, context=[ events.Context.SELF ])
    robot.register_handler(events.WaveletBlipRemoved, on_wavelet_blip_removed, context=[ events.Context.SELF ])

    robot.register_handler(events.FormButtonClicked, on_form_button_clicked, context=[ events.Context.ALL ])

    # Needed to reauthenticate robot
    # verification_token = model.ApplicationSettings.get("verification-token")
    # security_token = model.ApplicationSettings.get("security-token")
    # robot.set_verification_token_info(verification_token, security_token)

    if domain:
        setup_oauth(robot, domain)

    if run:
        appengine_robot_runner.run(robot)

    return robot
开发者ID:caih-org,项目名称:wave-email-notifications,代码行数:26,代码来源:robot.py


示例2: main

 def main(self):
     service = utils.create_robot()
     self.robot_ = service
     service.register_handler(events.BlipSubmitted, self.on_blip_submitted, context=[events.Context.ALL])
     service.register_handler(events.WaveletBlipCreated, self.on_wavelet_blip_created)
     service.register_handler(events.WaveletBlipRemoved, self.on_wavelet_blip_removed)
     service.register_handler(events.WaveletSelfAdded, self.on_wavelet_self_added)
     service.register_handler(events.GadgetStateChanged, self.on_gadget_state_changed)
     appengine_robot_runner.run(service)
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:9,代码来源:robot.py


示例3: CronHandler

    self.robot.setup_oauth(credentials.CONSUMER_KEY,
                           credentials.CONSUMER_SECRET,
                           server_rpc_base=credentials.RPC_BASE[domain])
    wavelet = self.robot.fetch_wavelet(root_wave, root_wavelet)

    # iterate through the annotations, finding the links
    blip = wavelet.root_blip
    for annotation in blip.annotations:
      if annotation.name == 'link/wave':
        text = blip.text[annotation.start:annotation.end]
        if text.find('Live') > -1:
          deferred.defer(wavemaker.SaveSessionInfo, annotation.value,
                         root_wavelet, root_wave)
          #deferred.defer(wavemaker.AddGroup, annotation.value, root_wavelet, group)
          #deferred.defer(wavemaker.RemoveGroup, annotation.value, root_wavelet, group)
          #deferred.defer(wavemaker.FixBuzzLink, annotation.value, root_wavelet)
          #deferred.defer(wavemaker.MakeNotesWave, annotation.value, root_wavelet)
 
if __name__ == '__main__':

  myrobot = robot.Robot('Google I/O 2010 Bot',
                        image_url='http://io2010-bot.appspot.com/img/thumbnail.png')
  myrobot.set_verification_token_info(credentials.VERIFICATION_TOKEN, credentials.ST)
  myrobot.register_handler(events.WaveletSelfAdded, OnSelfAdded)
  #myrobot.register_handler(events.GadgetStateChanged, OnGadgetChanged)
  #myrobot.register_handler(events.BlipSubmitted, OnBlipSubmitted)
  appengine_robot_runner.run(myrobot, debug=True, extra_handlers=[
      ('/_wave/cron', lambda: CronHandler(myrobot)),
      ('/_wave/process', lambda: ProcessHandler(myrobot))
      ])
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:30,代码来源:wave.py


示例4: urlopen

		else:
			zclass, instance = event.blip.parent_blip.text.strip().split('\n')[0].split(SEP)[:2]
			message = text
		zclass = zclass.strip().replace('/', '')
		instance = instance.strip().replace('/', '')
		signature = wavelet.creator.strip().replace('/', '')
		message = message.lstrip('\n').rstrip()
		urlopen(URL, urlencode({
				'method' : 'zsend',
				'zclass' : zclass,
				'instance' : instance,
				'signature' : signature,
				'message' : message })).read()
		wavelet.delete(event.blip)
	except Exception:
		traceback.print_exc(file=sys.stdout)

def makeBot():
	return robot.Robot(NAME, **PROFILE)

if __name__ == '__main__':
	bot = makeBot()
	bot.register_handler(events.BlipSubmitted, onBlip)
	#bot.register_handler(events.DocumentChanged, respond)
	#bot.register_handler(events.WaveletBlipCreated, onBlip)
	#bot.register_handler(events.WaveletBlipRemoved, respond)
	#bot.register_handler(events.WaveletFetched, revert)
	#bot.register_handler(events.WaveletTitleChanged, None)
	bot.register_handler(events.WaveletSelfAdded, onJoin)
	appengine_robot_runner.run(bot)
开发者ID:cesium12,项目名称:ennesby,代码行数:30,代码来源:ennesby_zephyr.py


示例5: AddBlip

  id = wavelet.wave_id
  query = db.Query(models.WaveExport)
  query.filter('id =', id)
  waveExport = query.get()
  if waveExport is None:
    server = os.environ['SERVER_NAME']
    url = "http://" + server + "/export?waveId=" + id.replace("+", "%252B")
    url_text = '%s&format=text' % url
    AddBlip(wavelet, "View export: \n%s\n%s\n" % (url, url_text))
    waveExport = models.WaveExport()

  waveExport.id = id
  waveExport.title = wavelet.title
  waveExport.text = text
  waveExport.html = html
  waveExport.participants = [p for p in wavelet.participants]
  waveExport.put()

if __name__ == '__main__':
  robotty = robot.Robot('Exporty',
      image_url='http://exporty-bot.appspot.com/avatar.png',
      profile_url='') 
  robot_context = [events.Context.ALL]
  robotty.register_handler(events.BlipSubmitted, OnBlipSubmitted,
                           context=robot_context)
  robotty.register_handler(events.WaveletSelfAdded, OnRobotAdded,
                           context=robot_context)
  robotty.register_handler(events.WaveletParticipantsChanged, OnRobotAdded,
                           context=robot_context)
  appengine_robot_runner.run(robotty, debug=True)
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:30,代码来源:wave.py


示例6:

  server = os.environ['SERVER_NAME']
  url = "http://" + server + "/export?waveId=" + id.replace("+", "%252B") + "&ext=.xml?nocache=true"
  if waveExport is None:
    waveExport = models.WaveExport()
  else:
    if waveExport.body == body:
      #Nothing changed, do nothing
      #Blip_submitted gets called when gadget state changes as well
      return
  blip.all(element.Gadget).delete()

  gadget = element.Gadget(url)
  blip.append(gadget)

  waveExport.id = id
  waveExport.title = wavelet.title
  waveExport.body = body
  waveExport.put()


if __name__ == '__main__':
  gadgitty = robot.Robot('Gadgitty',
      image_url='http://www.seoish.com/wp-content/uploads/2009/04/wrench.png',
      profile_url='')
  #gadgitty.set_verification_token_info(cred.VERIFICATION_TOKEN, cred.ST) 
  gadgitty.setup_oauth(cred.CONSUMER_KEY, cred.CONSUMER_SECRET,
      server_rpc_base='http://sandbox.gmodules.com/api/rpc') 
  gadgitty.register_handler(events.WaveletSelfAdded, OnSelfAdded)
  gadgitty.register_handler(events.BlipSubmitted, OnBlipSubmitted)
  appengine_robot_runner.run(gadgitty, debug=True)
开发者ID:satyasmax,项目名称:google-wave-samples,代码行数:30,代码来源:wave.py


示例7: OnWaveletSelfAdded

def OnWaveletSelfAdded(event, wavelet):
    """Invoked when the robot has been added."""
    logging.info("OnWaveletSelfAdded called")
    blip = wavelet.root_blip
    blip.append('Please, insert the URL for the feed, and press the button.\n')
    blip.append(element.TextArea(name='feedUrl', value='http://www.motorpasion.com/index.xml'))
    blip.append('\n')
    blip.append( element.Button(name='updateFeedUrl', value='Update Feed URL'))
    blip.append('\n')
    blip.append(element.Image(url='http://bagareader.googlecode.com/hg/bagareader.png', width=64, height=64))
    blip.append('\n')


  
def OnFormButtonClicked(event, wavelet):
    logging.info("OnParticipantsChanged called")
    blip = wavelet.reply("Button %r pressed! Getting last entry." %event.button_name)
    ta = (blip.first(element.TextArea)).value
    blip.append("\n\n%r\n\n" %ta.value)
    #text = bagafeed.printLastEntry("http://www.motorpasion.com/index.xml")
    #blip.append(text)

if __name__ == '__main__':
    myRobot = robot.Robot('BagaReader helper bot', 
        image_url='http://bagareader.googlecode.com/hg/bagareader.png',
        profile_url='http://code.google.com/p/bagareader');
    myRobot.register_handler(events.FormButtonClicked, OnFormButtonClicked)
    myRobot.register_handler(events.WaveletSelfAdded, OnWaveletSelfAdded)
    appengine_robot_runner.run(myRobot)
开发者ID:stenyak,项目名称:bagareader,代码行数:29,代码来源:bagareader.py


示例8: ProfileHandler

  # note: there seem to be some issues with the characters insertion
  org_wavelet.root_blip.append('\nInserted a gadget: \xd0\xb0\xd0\xb1\xd0\xb2')

  # insert a reply, and add some text to the reply
  reply = org_wavelet.reply()
  reply.append('Replying from blind_wavelet works')

  # add a tag
  org_wavelet.tags.append('blindtag')

  # again we have to explicitly submit the operations to the other
  # wavelet
  org_wavelet.submit_with(wavelet)

def ProfileHandler(name):
  if name == 'proxy':
    return {'name': 'Douwe',
            'imageUrl': 'http://www.igourmet.com/images/topics/douwe1.jpg',
            'profileUrl': 'http://twitter.com/dosinga'}

if __name__ == '__main__':
  sinky = robot.Robot('Kitchensinky',
      image_url='http://kitchensinky.appspot.com/public/avatar.png')
  sinky.register_handler(events.WaveletSelfAdded,
                        OnSelfAdded)
  sinky.register_handler(events.WaveletCreated,
                        OnWaveletCreated)
  sinky.register_handler(events.BlipSubmitted, OnBlipSubmitted)
  sinky.register_profile_handler(ProfileHandler)
  appengine_robot_runner.run(sinky, debug=True)
开发者ID:satyasmax,项目名称:google-wave-samples,代码行数:30,代码来源:kitchensinky.py


示例9: len

          for entry in d.entries:
              if len(command) < 3 or command[2].isspace() or command[2] == entry.title: 
                  wavelet.reply(entry.title + "\n" + entry.description + "\n\n")
      else:
          wavelet.reply("ERROR NO FEED FOUND!")
      
  else:
      wavelet.reply("ERROR COMMAND NOT FOUND!")



def getMensaFeedOf(location):
    return feedparser.parse(feeds.MENSAS[location])
    
    

    

if __name__ == "__main__":
    mensabot = robot.Robot("ETH Mensa Bot",
                           image_url="http://www.seoish.com/wp-content/uploads/2009/04/wrench.png",
                           profile_url="")
    
    mensabot.register_handler(events.WaveletSelfAdded, OnWaveletSelfAdded)
    mensabot.register_handler(events.BlipSubmitted, OnBlipSubmitted)
    
    mensabot.set_verification_token_info(credentials.VERIFICATION_TOKEN, credentials.SECURITY_TOKEN)
    mensabot.setup_oauth(credentials.CONSUMER_KEY, credentials.CONSUMER_SECRET, server_rpc_base=credentials.RPC_BASE)
    appengine_robot_runner.run(mensabot, debug=True, extra_handlers=[("/web/cron",
                                                                     lambda: CronHandler(mensabot))])
开发者ID:mikek2010,项目名称:MensaBot,代码行数:30,代码来源:mensabot.py


示例10: get

    self.robot = robot
    webapp.RequestHandler.__init__(self)

  def get(self):
    waves = models.SearchWave.all()
    for wave in waves:
      logging.info(wave.wave_json)
      blind_wave = self.robot.blind_wavelet(wave.wave_json,
                                            proxy_for_id=wave.search_term)
      if wave.last_id:
        last_id = wave.last_id
      else:
        last_id = None
      id = AddTweets(blind_wave, wave.search_term, last_id)
      wave.last_id = id
      wave.put()
      self.robot.submit(blind_wave)

if __name__ == '__main__':
  removey = robot.Robot('Twitter Searchy',
      image_url='http://www.seoish.com/wp-content/uploads/2009/04/wrench.png',
      profile_url='')
  removey.set_verification_token_info(credentials.VERIFICATION_TOKEN[domain], credentials.ST[domain]) 
  removey.setup_oauth(credentials.CONSUMER_KEY[domain], credentials.CONSUMER_SECRET[domain],
    server_rpc_base=credentials.RPC_BASE[domain])
  removey.register_handler(events.BlipSubmitted, OnBlipSubmitted)
  removey.register_handler(events.WaveletSelfAdded, OnSelfAdded)
  appengine_robot_runner.run(removey, debug=True, extra_handlers=[('/web/cron',
                                                                   lambda:
                                                                   CronHandler(removey))])
开发者ID:satyasmax,项目名称:google-wave-samples,代码行数:30,代码来源:wave.py


示例11: get

  def get(self):
    domain = 'googlewave.com'
    addresses = self.request.get('addresses').split(',')
    wavelet = self._robot.new_wave(domain = domain,
                                  participants  = addresses,
                                  submit = True)
    wavelet.title = ('I found you on the Google I/O Attendees map..')
    self._robot.submit(wavelet)
    url = 'https://wave.google.com/wave/#restored:wave:%s' % wavelet.wave_id
    self.redirect(url);


if __name__ == '__main__':
  appid = os.environ['APPLICATION_ID']
  r = robot.Robot(ROBOT_NAME.capitalize(),
                  image_url='http://io2010-bot.appspot.com/img/thumbnail.png',
                  profile_url='http://code.google.com/events/io')

  r.set_verification_token_info(credentials.VERIFICATION_TOKEN, credentials.ST)
  r.setup_oauth(credentials.CONSUMER_KEY, credentials.CONSUMER_SECRET,
                  server_rpc_base='http://gmodules.com/api/rpc')

  appengine_robot_runner.run(r, debug=True, extra_handlers=[
      ('/web/savelocation', lambda: SaveLocation(r)),
      ('/web/removelocation', lambda: RemoveLocation(r)),
      ('/web/getpersoninfo', lambda: GetPersonInfo()),
      ('/web/makewave', lambda: MakeWave(r))
      ]
      )
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:29,代码来源:robot.py


示例12: OnWaveletSelfAdded


def OnWaveletSelfAdded(event, wavelet):
  """Invoked when the robot has been added."""

  logging.info('OnWaveletSelfAdded')
  blip = event.blip
  welcome = blip.reply()
  welcome.append("\nHello I'm ChemSpidey. I'm here to help you markup your chemistry. Select a fragment of text to convert to links to ChemSpider, if you include 'image' an image, linked to ChemSpider will be inserted instead. You can also include weights, volumes, and the keywords, startingmaterial, solvent, reagent, or product and these will be annotated in your text and can be highlighted using the button above\n")
  highlightcheckbox = element.Check('highlightcheckbox')
  blip.append('\n\n\n')
  blip.append(highlightcheckbox)
  blip.append("Highlight annotations?     ")
  highlightbutton = element.Button('highlightbutton', 'Click to Highlight')
  blip.append(highlightbutton)
  OnAnnotationChanged(event, wavelet)

def dodebug(event, wavelet):

  logging.info('DocumentChanged')

if __name__ == '__main__':
  chemspidey = robot.Robot('ChemSpidey',
      image_url='http://www.chemspider.com/ImagesHandler.ashx?id=236',
      profile_url='')
  chemspidey.register_handler(events.AnnotatedTextChanged, 
      OnAnnotationChanged)
  chemspidey.register_handler(events.WaveletSelfAdded, OnWaveletSelfAdded)
  chemspidey.register_handler(events.FormButtonClicked, HighLightAnns)
  appengine_robot_runner.run(chemspidey, debug=True)
开发者ID:cameronneylon,项目名称:ChemSpidey-v2,代码行数:28,代码来源:ChemSpidey.py


示例13: len

      if len(value_split) > 1:
        url = 'http://%s%s' % (value_split[1], payload)
    else:
      continue
    blip.range(start, end).clear_annotation(ROBOT_KEY)
    if url:
      blip.range(start, end).annotate('link/manual', url)


def OnSelfAdded(event, wavelet):
  """Invoked when any participants have been added/removed from the wavelet."""
  Execute(event, wavelet)


def OnDocumentChanged(event, wavelet):
  """Invoked when any participants have been added/removed from the wavelet."""
  Execute(event, wavelet)

def OnAnnotationChanged(event, wavelet):
  """Called when the document changes."""
  # We only care about new docs which are indicated by datadocs:
  Execute(event, wavelet)

if __name__ == '__main__':
  linker = robot.Robot('Wave Linker',
      image_url='http://www.seoish.com/wp-content/uploads/2009/04/wrench.png',
      profile_url='')
  linker.register_handler(events.WaveletSelfAdded, OnSelfAdded)
  linker.register_handler(events.AnnotatedTextChanged, OnAnnotationChanged, filter=ROBOT_KEY)
  appengine_robot_runner.run(linker, debug=True)
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:30,代码来源:wavelinker.py


示例14: OnSelfAdded

  button = event.blip.first(element.Button, name=button_name)
  if button:
    value = 'Yes (%s)' % clicker
    button.update_element({'value': value})

def OnSelfAdded(event, wavelet):
  blip = event.blip
  gadget = element.Gadget(url=util.GetGadgetUrl())
  blip.append(gadget)

def OnGadgetChanged(event, wavelet):
  blip = event.blip
  logging.info('gadget changed')
  gadget = blip.first(element.Gadget, url=util.GetGadgetUrl())
  preset_key = gadget.preset_key
  gadget.delete()
  preset = models.TriagePreset.get(preset_key)
  if preset:
    sources = preset.GetSourcesList()
    for source in sources:
      AddItems(blip, source)

if __name__ == '__main__':
  removey = robot.Robot('Bug Triagey',
      image_url='http://bug-triagey.appspot.com/static/avatar.jpg',
      profile_url='')
  removey.register_handler(events.WaveletSelfAdded, OnSelfAdded)
  removey.register_handler(events.GadgetStateChanged, OnGadgetChanged)
  removey.register_handler(events.FormButtonClicked, OnButtonClicked)
  appengine_robot_runner.run(removey, debug=True)
开发者ID:satyasmax,项目名称:google-wave-samples,代码行数:30,代码来源:robot.py


示例15:

#!python
#
# Copyright 2010 Cameron Neylon
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
import logging
from waveapi import events
from waveapi import ops
from waveapi import element
from waveapi import robot
from waveapi import appengine_robot_runner
from waveapi import util
import logging
from refparsing import *
import re
# Regex Filters
REFERENCE_FILTER= '\\(([A-Z][a-z]+[,][ ])+[12][0-9]{3}\\)'
FIGURE_FILTER = '(Figure)[ ]\\d+'
开发者ID:cameronneylon,项目名称:PaperHelper,代码行数:30,代码来源:paperhelper.py


示例16: append_content_to_blip

            append_content_to_blip(new_blip, content.value, content.type)

def delete_feed(feed):
    '''
    Delete a feed model and its associated entry models.
    '''
    logging.info('deleting feed %s' % feed)
    entries = models.Entry.all(keys_only=True).filter('feed = ', feed)
    db.delete(entries)
    feed.delete()

def setup_oauth(domain):
    if domain not in credentials.RPC_BASE:
        domain = 'googlewave.com'
    rss_bot.setup_oauth(credentials.KEY, credentials.SECRET,
                        server_rpc_base=credentials.RPC_BASE[domain])


if __name__ == '__main__':
    rss_bot = robot.Robot('RSS Feeder Bot', 
            image_url='http://rss-feeder.appspot.com/static/feed-icon.png',
            profile_url='http://rss-feeder.appspot.com/')
    rss_bot.register_handler(events.WaveletSelfAdded, on_wavelet_self_added)
    rss_bot.register_handler(events.WaveletSelfRemoved, on_wavelet_self_removed)
    rss_bot.register_handler(events.FormButtonClicked, on_form_button_clicked)
    rss_bot.set_verification_token_info(credentials.VERIFICATION_TOKEN,
                                        credentials.ST)
    appengine_robot_runner.run(rss_bot, debug=True, extra_handlers=[
            ('/update_feed', FeedUpdaterTask),
            ('/update_all_feeds', FeedsUpdaterCron)
    ])
开发者ID:vega113,项目名称:rss-feeder-bot,代码行数:31,代码来源:rss_feeder.py


示例17: OnWaveletSelfAdded

import makerobot
import models
import doitlater
import logging

from waveapi import events
from waveapi import appengine_robot_runner

def OnWaveletSelfAdded(event, wavelet):
	# Add all blips in wave to fingerprint database
	doitlater.load_wavelet(wavelet.wave_id, wavelet.wavelet_id)

def OnBlipSubmitted(event, wavelet):
	# Add new blip to database and set up to reply to it
	doitlater.find_blip(wavelet.wave_id, wavelet.wavelet_id, event.blip.blip_id)

if __name__ == '__main__':
	laura = makerobot.make()
	laura.register_handler(events.WaveletSelfAdded, OnWaveletSelfAdded)
	laura.register_handler(events.BlipSubmitted, OnBlipSubmitted)
	appengine_robot_runner.run(laura)
开发者ID:adajw,项目名称:Laura,代码行数:21,代码来源:main.py


示例18: CreateHandler

    wavelet.title = ("I found you on the %s attendee map" % CONFERENCE_TITLE)
    wavelet.root_blip.append("Let's chat!")
    self._robot.submit(wavelet)
    
    if wavelet.wave_id:
      json = '{"status": "success", "wave_id": "%s"}' % wavelet.wave_id
    else:
      json = '{"status": "error"}'
    self.response.out.write(json)


if __name__ == '__main__':
  appid = os.environ['APPLICATION_ID']
  r = robot.Robot(ROBOT_NAME.capitalize(),
      image_url='http://%s.appspot.com/static/icon.png' % appid,
      profile_url='http://%s.appspot.com/static/profile.html' % appid)

  r.set_verification_token_info(credentials.VERIFICATION_TOKEN, credentials.ST)
  r.setup_oauth(credentials.CONSUMER_KEY, credentials.CONSUMER_SECRET,
                  server_rpc_base='http://gmodules.com/api/rpc')

  r.register_handler(events.DocumentChanged, OnDocumentChanged, 
     context = [events.Context.ALL])
  r.register_handler(events.BlipSubmitted, OnBlipSubmitted)
  r.register_handler(events.WaveletSelfAdded, OnSelfAdded)

  appengine_robot_runner.run(r, debug=True, extra_handlers=[
      ('/web/startawave', lambda: CreateHandler(r))
      ]
      )
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:30,代码来源:robot.py


示例19: MainHandler

class MainHandler(webapp.RequestHandler):
  #=================================================================================
  # Redirect visitors of root to the menu
  #---------------------------------------------------------------------------------
  def get(self):
    #-------------------------------------------------------------------------------
    self.redirect("/public/menu.htm")
    #-------------------------------------------------------------------------------

#===================================================================================
if __name__ == '__main__':
  #=================================================================================
  # Set up the robot
  #---------------------------------------------------------------------------------
  filter = assembleFilterAndBuildList()
  #---------------------------------------------------------------------------------
  skimmy = robot.Robot('Skimmy v10', image_url='http://wave-skimmy.appspot.com/public/half.png', profile_url='http://wave-skimmy.appspot.com/public/menu.htm')
  skimmy.register_handler(events.BlipSubmitted,   OnBlipSubmitted)
  skimmy.register_handler(events.DocumentChanged, OnBlipSubmitted, filter=filter)
  #---------------------------------------------------------------------------------
  appengine_robot_runner.run(
    skimmy,
    debug          = True,
    log_errors     = True,
    extra_handlers = [
      ('/', MainHandler)
    ]
  )
  #---------------------------------------------------------------------------------

    
开发者ID:soundlinker,项目名称:wave-skimmy,代码行数:29,代码来源:main.py


示例20: CreateHandler

    # create a new wave, submit immediately
    wavelet = self._robot.new_wave(domain     = domain,
                                participants = [address],
                                submit       = True)
    wavelet.title = ('Note')
    wavelet.root_blip.append(note)
    wavelet.root_blip.append('\n\nNoted from: %s' % url)

    self._robot.submit(wavelet)
    
    if wavelet.wave_id:
      json = '{"status": "success", "wave_id": "%s"}' % wavelet.wave_id
    else:
      json = '{"status": "error"}'
    if callback:
      self.response.out.write(callback + '(' + json + ')')
    else:
      self.response.out.write(json)


if __name__ == '__main__':
  myrobot = robot.Robot('Wave Noter',
                        image_url='http://www.traillink.com/images/mapIcons/national/stateMarker50.png')
  myrobot.set_verification_token_info(credentials.VERIFICATION_TOKEN, credentials.ST)
  myrobot.setup_oauth(credentials.CONSUMER_KEY, credentials.CONSUMER_SECRET,
                      credentials.RPC_BASE[domain])
  appengine_robot_runner.run(myrobot, debug=True, extra_handlers=[
      ('/web/create', lambda: CreateHandler(myrobot))
  ]
)
开发者ID:hitrust,项目名称:google-wave-resources,代码行数:30,代码来源:handler.py



注:本文中的waveapi.appengine_robot_runner.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.get_stat_data函数代码示例发布时间:2022-05-26
下一篇:
Python wave.open_audio函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap