468,532 Members | 1,722 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,532 developers. It's quick & easy.

sending commands in body of HTTP with urllib2

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


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' %
authheader = "Basic %s" % user_pass

opener.addheaders = [('Accept-Language','en-us'),
('Accept-Encoding','gzip, deflate'),

# install it

# use it
url =
'http://gateway.messenger.hotmail.com/gateway/gateway.dll?Action=open&Server=NS&IP=messenger.hot mail.com'
values = 'VER 5 MSNP8 CVR0'

f = urllib2.urlopen(url,values)
print f.headers
print f.read()

Thanks for any help!
Jan 3 '08 #1
0 1009

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Matthew Wilson | last post: by
2 posts views Thread by OvErboRed | last post: by
7 posts views Thread by Michael Foord | last post: by
4 posts views Thread by Dekaritae | last post: by
3 posts views Thread by John Reese | last post: by
2 posts views Thread by itay_k | last post: by
reply views Thread by Jonas Galvez | last post: by
2 posts views Thread by silk.odyssey | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.