當前位置: 首頁>>代碼示例>>Python>>正文


Python History.to_dict方法代碼示例

本文整理匯總了Python中models.History.to_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python History.to_dict方法的具體用法?Python History.to_dict怎麽用?Python History.to_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.History的用法示例。


在下文中一共展示了History.to_dict方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: post

# 需要導入模塊: from models import History [as 別名]
# 或者: from models.History import to_dict [as 別名]
    def post(self):
        isajax = self.request.get('isajax')
        phone = self.request.get('phone')
        msg = self.request.get('msg')
        contact_name = self.request.get('contact_name')

        user = users.get_current_user()
        email = user.email().lower()
        q = Token.query(Token.email == email)
        token = q.get()
        status = 100
        hist=''
        logging.debug(email + ' ' + phone + ' ' + msg + ' ' + contact_name)
        if token:
            status = 101
            if len(phone) and len(msg):
                status = 200
                hist = History(email=email, msg=msg, phone=phone, contact_name = contact_name)
                hist.put()
                airship.push({
                    "android": {
                         "extra": {"msgid": str(hist.key.id()), "phone": phone, "msg":msg}
                    }
                }, apids=[token.apid])
                id = hist.key.id()
                hist = hist.to_dict()
                hist['created']=hist['created'].isoformat();
                hist['id'] = id
                hist['type'] = 'sms'        
        self.response.out.write(json.dumps({'status':status, 'msg':hist}))
開發者ID:spicavigo,項目名稱:onlinesms_server,代碼行數:32,代碼來源:hello_world.py

示例2: get

# 需要導入模塊: from models import History [as 別名]
# 或者: from models.History import to_dict [as 別名]
 def get(self):
     contact_name = self.request.get('contact_name')    
     phone = self.request.get('phone')
     msg = self.request.get('msg')
     email = self.request.get("email",'').lower()
     hist = History(email=email, msg=msg, phone=phone, contact_name = contact_name, byme=False)
     hist.put()
     id = hist.key.id()
     hist = hist.to_dict()
     hist['created']=hist['created'].isoformat();
     hist['id'] = id
     hist['type'] = 'sms'  
     channel.send_message(email, json.dumps(hist))
     self.response.out.write(json.dumps({}))
開發者ID:spicavigo,項目名稱:onlinesms_server,代碼行數:16,代碼來源:hello_world.py


注:本文中的models.History.to_dict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。