本文整理汇总了Python中models.Account.get_by_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_by_key_name方法的具体用法?Python Account.get_by_key_name怎么用?Python Account.get_by_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Account
的用法示例。
在下文中一共展示了Account.get_by_key_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_key_name [as 别名]
def post(self):
username = self.request.get("username")
account = Account.get_by_key_name(username)
account.wb_access_token = self.request.get("wb_access_token")
account.put()
self.redirect('/binding.html')
示例2: post
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_key_name [as 别名]
def post(self):
username = self.request.get("username")
account = Account.get_by_key_name(username)
account.wb_bot_sina = self.request.get("wb_bot")
account.wb_bot_vericode = self.request.get("wb_vericode")
account.put()
xmpp.send_invite(account.wb_bot_sina, from_jid=account.wb_bot_mine)
xmpp.send_message(account.wb_bot_sina, account.wb_bot_vericode, from_jid=account.wb_bot_mine)
self.redirect('/binding.html')
示例3: who_command
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_key_name [as 别名]
def who_command(self, message=None):
idx_email = message.sender.index('/')
email = message.sender[0:idx_email]
# Get the account
account = Account.get_by_key_name(
key_names=email
)
contacts = account.search_contacts(message.arg)
reply = ''
if contacts:
for c in contacts:
reply += c + '\n'
message.reply(reply)
示例4: text_message
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_key_name [as 别名]
def text_message(self, message):
#Get sender's email
idx = message.sender.index('/')
email = message.sender[0:idx]
# Get the latest sender's phone number
account = Account.get_by_key_name(
key_names=email
)
message_key = account.reply_to_last(message.arg)
gcm = GCM(API_KEY)
gcm.plaintext_request(
registration_id=account.registration_id,
data={'key': message_key},
collapse_key=str(message_key)
)
示例5: sms_command
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_key_name [as 别名]
def sms_command(self, message=None):
idx_email = message.sender.index('/')
email = message.sender[0:idx_email]
idx_phone = message.arg.index(':')
phone = message.arg[0:idx_phone]
content = unicode(message.arg[idx_phone + 1:])
# Get the account
account = Account.get_by_key_name(
key_names=email
)
message_key = self.account.send_message_to(
phones=[phone], content=content
)
gcm = GCM(API_KEY)
gcm.plaintext_request(
registration_id=account.registration_id,
data={'key': message_key},
collapse_key=str(message_key)
)
message.reply("SMS has been sent to: %s" % phone)
示例6: get_account
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_key_name [as 别名]
def get_account(self):
self.user = users.get_current_user()
self.account = Account.get_by_key_name(
key_names=self.user.email()
)