示例#1
0
    def post(self, id):
        params = self.params(['include_entities'])
        
        token = md.get_default_access_token()
        if not token:
            self.write(json.dumps({
                'success':False,
                'info':'No access token avaliable.',
            }))
            return
        
        td = Twitdao(token)
        message = td.direct_messages_destroy(id=id, **params)

        if 'error' in message:
            self.write(json.dumps({
                'success':False,
                'info':message['error'],
            }))
        else:
            self.write(json.dumps({
                'success':True,
                'info':'OK',
                'message':message,
            }))
示例#2
0
文件: main.py 项目: tongsu/twitdao
    def post(self, id):
        params = self.params(["include_entities"])

        token = md.get_default_access_token()
        if not token:
            self.redirect("/settings")
            return

        td = Twitdao(token)
        message = td.direct_messages_destroy(id=id, **params)
        self.redirect("/a/messages_sent")