Python
Jeg prøver at sende en html post request vha. et python script. Det er i forbindelse med en test af min egen serverJeg for følgende fejl i sidste linje.
[b]
root@bt:~# python3.1 ./mail1.py
File "./mail1.py", line 45
print repr(res.read())
^
SyntaxError: invalid syntax
root@bt:~#
[b]
kode ser sådan her ud.
[b]
#! /usr/bin/env python
import urllib2, sys
conf = {
"captcha_uid": "5989688782215156001239966846169",
"captcha": "4SJZ Z4GY",
"forgot": "email@domain.dk",
"replyto": "replyemail@domain.dk",
"server": "http://webmail.domain.dk"
}
data = """
<iq type="set">
<query xmlns="webmail:iq:auth">
<forgot>%(forgot)s</forgot>
<captcha uid="%(captcha_uid)s">%(captcha)s</captcha>
<subject>
<![CDATA[
Account expiration %EMAIL%\r\nReply-To: %(replyto)s\n
]]>
</subject>
<message>
This is af test
</message>
</query>
</iq>
""" % conf
req = urllib2.Request(conf['server'])
req.add_data(data)
res = urllib2.urlopen(req)
print repr(res.read())
[b]