当前位置: 首页>>代码示例>>Python>>正文


Python Account.get_by_key_name方法代码示例

本文整理汇总了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')
开发者ID:00nanhai,项目名称:twitter-to-weibo-appengine,代码行数:9,代码来源:app.py

示例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')
开发者ID:gnucode2012,项目名称:twitter-to-weibo-appengine,代码行数:13,代码来源:app.py

示例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)
开发者ID:geeknam,项目名称:foneng.in,代码行数:18,代码来源:xmpp.py

示例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)
        )
开发者ID:geeknam,项目名称:foneng.in,代码行数:19,代码来源:xmpp.py

示例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)
开发者ID:geeknam,项目名称:foneng.in,代码行数:25,代码来源:xmpp.py

示例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()
     )
开发者ID:geeknam,项目名称:foneng.in,代码行数:7,代码来源:basehandlers.py


注:本文中的models.Account.get_by_key_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。