1 #!/usr/bin/env python 2 3 from MoinMessage import parseURL 4 import httplib 5 import sys 6 7 if __name__ == "__main__": 8 url = sys.argv[1] + "?action=PostMessage" 9 10 text = sys.stdin.read() 11 scheme, host, port, path = parseURL(url) 12 13 if scheme != "http": 14 print >>sys.stderr, "Only http URLs are supported." 15 sys.exit(1) 16 17 req = httplib.HTTPConnection(host, port) 18 req.request("PUT", path, text) # {"Content-Length" : len(text)} 19 resp = req.getresponse() 20 print resp.read() 21 22 # vim: tabstop=4 expandtab shiftwidth=4