本文整理匯總了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}))
示例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({}))