[Wolves] Mailing lists and web forums

Aquarius wolves at mailman.lug.org.uk
Thu Jan 9 16:20:01 2003


Jon Farmer spoo'd forth:
>> I'm also unclear how you'd invoke this custom module from the command
> line,
>> but I'm sure that that's just lack of knowledge on my part rather than
>> because it can't be easily done :)
> 
> Correct :-)
> 
> Just dont ask me how to do it in Python!

Like this:

import urllib
d = { "subject": "A post from test.py",
      "image_subject": "icon1.gif",
      "message": """This is the full text of a post made by test.py.
       It contains embedded newlines and embedded <strong>HTML</strong>.""",
      "forum": "5",
      "submit": "Send"
    }
postReq = urllib.urlencode(d)
formAction = "http://www.wolveslug.org.uk/modules.php?op=modload&name=Forums&file=newtopic"
res = urllib.urlopen(formAction,postReq)

Pretty simple, huh? I did inadvertently post twice to the main forum
(because I put the wrong forum number in, oops) but that's all the code you
need. Pretty easy, eh?

Obviously the final script will need to be more complicated; it needs to
know whether the mail it's echoing to the forum is a new post or follows up
an old one, etc etc, but the principle is there.

Aq.

-- 
>> Heard a lot about eggnog, but I have never experienced it
>>first-hand. What is this thing made off?
> Isn't it obvious? Eggs and nog, of course.
Don't pay any attention to him, Sid. It's eggs, *sugar*, and nog.
           -- Jason <jbeasley@primary.net> on rec.humor.oracle.d