示例#1
0
 def take(self):
     query = Orders.query()
     return_string = "You need to get:```"
     for x in query:
         return_string += "{} for {} \n".format(x.order, x.user_name)
         x.key.delete()
     args = {"response_type": "in_channel",
         "text": "{} has agreed to go and get your orders! :smile:".format(self.user_name)}
     request = urllib2.Request(self.url_to_return)
     request.add_header('content-type', 'application/json')
     resp = urllib2.urlopen(request, json.dumps(args))
     return return_string + "```"
示例#2
0
 def view(self):
     query = Orders.query()
     return_string = "```"
     for x in query:
         return_string += "{} ordered {} \n".format(x.user_name, x.order)
     return return_string + "```"