Re: HTTP post with urllib2

2013-08-07 Thread cerr
On Tuesday, August 6, 2013 5:14:48 PM UTC-7, MRAB wrote: > On 06/08/2013 23:52, cerr wrote: > > > Hi, > > > > > > Why does this code: > > > > > > #!/usr/bin/python > > > > > > > > > import urllib2 > > > from binascii import hexlify, unhexlify > > > > > > host = "localhost" > > > uri="/t

Re: HTTP post with urllib2

2013-08-06 Thread Chris Angelico
On Tue, Aug 6, 2013 at 11:52 PM, cerr wrote: > ./post.py > Traceback (most recent call last): > File "./post.py", line 13, in > response = urllib2.urlopen(req, 120) > File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen > return _opener.open(url, data, timeout) > File "/usr/li

Re: HTTP post with urllib2

2013-08-06 Thread MRAB
On 06/08/2013 23:52, cerr wrote: Hi, Why does this code: #!/usr/bin/python import urllib2 from binascii import hexlify, unhexlify host = "localhost" uri="/test.php" data ="\x48\x65\x6C\x6C\x6F\x57\x6F\x72\x6C\x64" #Hello World url="http://{0}{1}?f=test".format(host, uri) req = urllib2.Reques

Re: HTTP post with urllib2

2013-08-06 Thread Joel Goldstick
On Tue, Aug 6, 2013 at 7:35 PM, cerr wrote: > On Tuesday, August 6, 2013 4:08:34 PM UTC-7, Joel Goldstick wrote: >> On Tue, Aug 6, 2013 at 6:52 PM, cerr wrote: >> >> > Hi, >> >> > >> >> > Why does this code: >> >> > >> >> > #!/usr/bin/python >> >> > >> >> > >> >> > import urllib2 >> >> > from bin

Re: HTTP post with urllib2

2013-08-06 Thread cerr
On Tuesday, August 6, 2013 4:08:34 PM UTC-7, Joel Goldstick wrote: > On Tue, Aug 6, 2013 at 6:52 PM, cerr wrote: > > > Hi, > > > > > > Why does this code: > > > > > > #!/usr/bin/python > > > > > > > > > import urllib2 > > > from binascii import hexlify, unhexlify > > > > > > host = "loc

Re: HTTP post with urllib2

2013-08-06 Thread Joel Goldstick
On Tue, Aug 6, 2013 at 6:52 PM, cerr wrote: > Hi, > > Why does this code: > > #!/usr/bin/python > > > import urllib2 > from binascii import hexlify, unhexlify > > host = "localhost" > uri="/test.php" > data ="\x48\x65\x6C\x6C\x6F\x57\x6F\x72\x6C\x64" #Hello World > url="http://{0}{1}?f=test".forma

HTTP post with urllib2

2013-08-06 Thread cerr
Hi, Why does this code: #!/usr/bin/python import urllib2 from binascii import hexlify, unhexlify host = "localhost" uri="/test.php" data ="\x48\x65\x6C\x6C\x6F\x57\x6F\x72\x6C\x64" #Hello World url="http://{0}{1}?f=test".format(host, uri) req = urllib2.Request(url, data,{'Content-Type': 'appli