NNTP Post a file

Daniel Daniel.Kinnaer at Advalvas.be
Thu May 3 14:18:10 EDT 2001


Thanks for all the replies.  The Python code is (as usual) very short
to do such a task.  It is the contents of the message that fires off
the message into the correct newsgroup - that's why I accidentaly sent
a test message into this newsgroup. Sorry for this!

For all of you who want to share my experiences, here's the code + the
message:

Python code:
import nntplib

print "start"
s = nntplib.NNTP('news.skynet.be')
f=open('c:/temp/mymsg.txt')
s.post(f)
s.quit
print "done..."

===
mymsg.txt:
From: Daniel <Daniel.Kinnaer at Advalvas.be>
Newsgroups: a.testing.group
Subject: Testing NNTP using Python
X-Newsreader: Python home brew
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 3

This is a testfile, please disregard.
Posting this file using Python
end of message

===

Thanks again for all the help!

regards,  Daniel



More information about the Python-list mailing list