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


Python User.parse方法代码示例

本文整理汇总了Python中user.User.parse方法的典型用法代码示例。如果您正苦于以下问题:Python User.parse方法的具体用法?Python User.parse怎么用?Python User.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.User的用法示例。


在下文中一共展示了User.parse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_user_info

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import parse [as 别名]
def get_user_info(save_file, uid_list, start):
    f = open(save_file, 'a')
    f2 = open('log', 'a')
    find = (start == -1)
    i = 0
    while i < len(uid_list):
        if find:
            print 'processing uid#%s' % uid_list[i]
            url = 'http://mac.pcbeta.com/space-uid-%s.html' % uid_list[i]
            user = User()
            html = http_get(url)
            if html is None:
                time.sleep(10)
                continue
            user.parse(html)
            if user.is_valid():
                f.write(str(user) + '\n')
                print 'write to file'
            else:
                login()
                i -= 1
        else:
            if uid_list[i] == str(start): find = True
        i += 1
    f.close()
    f2.close()
开发者ID:FindBoat,项目名称:pcbeta-password,代码行数:28,代码来源:main.py

示例2: catch_kicks

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import parse [as 别名]
 def catch_kicks(self, msg):
   message = Message(msg)
   if message.command == "KICK" and message.params_no_trailing[0].lower() == self.name.lower():
     kicker = User.parse(message.prefix)
     kickee = User.parse(message.params_no_trailing[1])
     self.someone_kicked.fire(kickee, kicker)
     self._remove_nick(kickee.nick)
     if kickee.nick == self.connection.nick:
       self._leave()
开发者ID:bblack,项目名称:pirc,代码行数:11,代码来源:channel.py

示例3: catch_nick

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import parse [as 别名]
 def catch_nick(self, msg):
   message = Message(msg)
   if message.command == "NICK":
     old_nick = User.parse(message.prefix).nick
     # Seems that a NICK message received has the new nick after the colon if successful;
     # no colon if e.g. name change was attempted too quickly.
     new_nick = message.trailing or message.params_no_trailing[0]
     if old_nick == self.nick:
       self.nick = new_nick
       print 'Successfully changed nick to ' + self.nick
     self.nick_changed.fire((old_nick, new_nick))
开发者ID:bblack,项目名称:pirc,代码行数:13,代码来源:connection.py

示例4: catch_joins

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import parse [as 别名]
 def catch_joins(self, msg):
   message = Message(msg)
   if message.command == "JOIN" and message.params_no_trailing[0].lower() == self.name.lower():
     self._add_nick(User.parse(message.prefix).nick)
开发者ID:bblack,项目名称:pirc,代码行数:6,代码来源:channel.py

示例5: catch_parts

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import parse [as 别名]
 def catch_parts(self, msg):
   message = Message(msg)
   if message.command == "PART" and message.params_no_trailing[0].lower() == self.name.lower():
     self._remove_nick(User.parse(message.prefix).nick)
开发者ID:bblack,项目名称:pirc,代码行数:6,代码来源:channel.py

示例6: catch_privmsgs

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import parse [as 别名]
 def catch_privmsgs(self, msg):
   message = Message(msg)
   if message.command == "PRIVMSG" and message.params_no_trailing[0].lower() == self.name.lower():
     user = User.parse(message.prefix)
     msg_text = message.trailing
     self.msg_received.fire(self, user, msg_text)
开发者ID:bblack,项目名称:pirc,代码行数:8,代码来源:channel.py


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