nntplib and xover
Gerhard Häring
gerhard.nospam at bigfoot.de
Tue Sep 18 16:09:36 EDT 2001
On Tue, 18 Sep 2001 16:38:17 GMT, Rick Pasotto <rickp at telocity.com> wrote:
>Some news servers return the Xref: line in response to the XOVER
>command. Currently the nntplib does not include this line.
>
>1) Will this be included in future versions?
Perhaps, if you submit a patch at Sourceforge. If you don't, it won't.
I've changed the xover method to support this, feel free to change this in your
Python source tree, create a patch and submit it:
#############
def xover(self,start,end):
"""Process an XOVER command (optional server extension) Arguments:
- start: start of range
- end: end of range
Returns:
- resp: server response if successful
- list: list of (art-nr, subject, poster, date,
id, references, size, lines, xref)"""
resp, lines = self.longcmd('XOVER ' + start + '-' + end)
xover_lines = []
for line in lines:
elem = line.split("\t")
xref = None
if len(elem) >= 8 and elem[8].startswith('Xref:'):
xref = elem[8]
try:
xover_lines.append((elem[0],
elem[1],
elem[2],
elem[3],
elem[4],
elem[5].split(),
elem[6],
elem[7],
xref))
except IndexError:
raise NNTPDataError(line)
return resp,xover_lines
#############
>2) What is the best way to get this line now?
See the above code :-)
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list