本文整理汇总了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()
示例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()
示例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))
示例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)
示例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)
示例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)