1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_post.py Fri Jul 20 21:58:47 2012 +0200
1.3 @@ -0,0 +1,30 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from email.mime.multipart import MIMEMultipart
1.7 +from email.mime.text import MIMEText
1.8 +import httplib
1.9 +import sys
1.10 +
1.11 +if __name__ == "__main__":
1.12 + host = sys.argv[1]
1.13 + path = sys.argv[2] + "?action=PostMessage"
1.14 +
1.15 + message = MIMEMultipart()
1.16 +
1.17 + text1 = MIMEText("An update to the Wiki.", "moin")
1.18 +
1.19 + text2 = MIMEText("Another update to the Wiki.", "moin")
1.20 +
1.21 + message.attach(text1)
1.22 + message.attach(text2)
1.23 +
1.24 + text = message.as_string()
1.25 + print text
1.26 + print
1.27 +
1.28 + req = httplib.HTTPConnection(host)
1.29 + req.request("PUT", path, text) # {"Content-Length" : len(text)}
1.30 + resp = req.getresponse()
1.31 + print resp.read()
1.32 +
1.33 +# vim: tabstop=4 expandtab shiftwidth=4