本文整理汇总了Python中nntplib.NNTP.list方法的典型用法代码示例。如果您正苦于以下问题:Python NNTP.list方法的具体用法?Python NNTP.list怎么用?Python NNTP.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nntplib.NNTP
的用法示例。
在下文中一共展示了NNTP.list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from nntplib import NNTP [as 别名]
# 或者: from nntplib.NNTP import list [as 别名]
def main():
s = NNTP(settings.nntp_hostname, settings.nntp_port)
resp, groups = s.list()
# check all of the groups, just in case
for group_name, last, first, flag in groups:
resp, count, first, last, name = s.group(group_name)
print "\nGroup", group_name, 'has', count, 'articles, range', first, 'to', last
resp, subs = s.xhdr('subject', first + '-' + last)
for id, sub in subs[-10:]:
print id, sub
s.quit()
示例2: __init__
# 需要导入模块: from nntplib import NNTP [as 别名]
# 或者: from nntplib.NNTP import list [as 别名]
class NewsGrep:
def __init__(self,server,username,password):
self.server = NNTP(server, 119,username,password)
def __del__(self):
pass
def __str__(self):
pass
def list(self):
resp, groups = self.server.list()
for group, last, first, flag in groups:
print group
def ls(self,group_name):
resp, count, first, last, name = self.server.group(group_name)
print 'Group', name, 'has', count, 'articles, range', first, 'to', last
resp, subs = self.server.xhdr('subject', first + '-' + last)
for id, sub in subs[-10:]:
print id, sub
示例3: Copyright
# 需要导入模块: from nntplib import NNTP [as 别名]
# 或者: from nntplib.NNTP import list [as 别名]
#!/usr/bin/env python
# Copyright (c) 2004 Joao Prado Maia. See the LICENSE file for more information.
# $Id: check_health.py,v 1.1 2004-01-25 06:10:33 jpm Exp $
import settings
from nntplib import NNTP
s = NNTP(settings.nntp_hostname, settings.nntp_port)
resp, groups = s.list()
# check all of the groups, just in case
for group_name, last, first, flag in groups:
resp, count, first, last, name = s.group(group_name)
print "\nGroup", group_name, 'has', count, 'articles, range', first, 'to', last
resp, subs = s.xhdr('subject', first + '-' + last)
for id, sub in subs[-10:]:
print id, sub
s.quit()