nntplib: abstraction of threads
Werner Amann
use-reply at eckeab.de
Sun Jan 16 12:02:29 EST 2005
Rakesh schrieb:
> What I want is to *group the messages belonging to each thread* .
Hello
Why not sort with Message-ID and References?
Attention - it is a Newbie-Solution.
import nntplib
hamster = nntplib.NNTP('127.0.0.1', 119, 'user', 'pass')
resp, count, first, last, name = hamster.group('comp.lang.python')
resp, items = hamster.xover(first,last)
start_dic = {}
re_dic = {}
numb = 1
for id,subject,author,date,message_id,references,size,lines in items:
if 'Re:' not in subject:
start_dic[subject] = (author, message_id)
else:
re_dic[numb] = (subject, author, references)
numb += 1
resp = hamster.quit()
for a in start_dic:
print a
print start_dic[a][0]
for b in re_dic:
if start_dic[a][1] in re_dic[b][2]:
print '|'
print ' ->', re_dic[b][0]
print ' ', re_dic[b][1]
print
--
Werner Amann
More information about the Python-list
mailing list