Hi, Im trying to implement the logic from http://www.hypothetic.org/docs/msn/general/http_connections.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.ProxyHandler({"http" : \ "http://%(host)s:%(port)d" % proxy_info}) opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler) user_pass = base64.encodestring('%s:%s' % (urllib.unquote(USER),urllib.unquote(PASS))) authheader = "Basic %s" % user_pass opener.addheaders = [('Accept-Language','en-us'), ('Accept-Encoding','gzip, deflate'), ('Host','gateway.messenger.hotmail.com'), ('Proxy-Connection','Keep-Alive'), ('Connection','Keep-Alive'), ('Pragma','no-cache'), ('Content-Type','application/x-msn-messenger'), ('User-agent','MSMSGS'), ('Accept','*/*'), ('Proxy-authorization',authheader)] # install it urllib2.install_opener(opener) # use it url = 'http://gateway.messenger.hotmail.com/gateway/gateway.dll?Action=open&Server=NS&IP=messenger.hotmail.com' values = 'VER 5 MSNP8 CVR0' f = urllib2.urlopen(url,values) print f.headers print f.read() Thanks for any help! -- http://mail.python.org/mailman/listinfo/python-list