Hi,
Im trying to implement the logic from
http://www.hypothetic.org/docs/msn/g...onnections.php to a
simple python code using urllib2 and some parts of urllib. Im behind a
http proxy that requires authentication that is why Im using urllib2. Im
asking for help on how to send commands in a body of a HTTP before
requesting for response. What am I doing wrong? I only get the response
from the server but my commands never seem to be acknowledged or
properly handled. Below is my code:
import urllib2
import base64
import urllib
USER='user'
PASS='pass'
proxy_info = {'host' : "proxy.com.au", 'port' : 8080}
# build a new opener that uses a proxy requiring authorization
proxy_support = urllib2.ProxyHa ndler({"http" : \
"http://%(host)s:%(port )d" % proxy_info})
opener = urllib2.build_o pener(proxy_sup port, urllib2.HTTPHan dler)
user_pass = base64.encodest ring('%s:%s' %
(urllib.unquote (USER),urllib.u nquote(PASS)))
authheader = "Basic %s" % user_pass
opener.addheade rs = [('Accept-Language','en-us'),
('Accept-Encoding','gzip , deflate'),
('Host','gatewa y.messenger.hot mail.com'),
('Proxy-Connection','Ke ep-Alive'),
('Connection',' Keep-Alive'),
('Pragma','no-cache'),
('Content-Type','applicat ion/x-msn-messenger'),
('User-agent','MSMSGS' ),
('Accept','*/*'),
('Proxy-authorization', authheader)]
# install it
urllib2.install _opener(opener)
# use it
url =
'http://gateway.messeng er.hotmail.com/gateway/gateway.dll?Act ion=open&Server =NS&IP=messenge r.hotmail.com'
values = 'VER 5 MSNP8 CVR0'
f = urllib2.urlopen (url,values)
print f.headers
print f.read()
Thanks for any help!