HTTP POST File without cURL

John Giotta jdgiotta at gmail.com
Fri Sep 11 10:20:57 EDT 2009


Is there a verbose feature for urllib2.urlopen?

Here is my python snippet for posted the file:

req = urllib2.Request(url='https://%s%s' % (host, selector),
data=open('test.zip', 'rb').read())
req.add_header('content-type', 'application/zip')
req.add_header('Authorization', 'Basic %s' % self.auth)
#req.add_header('content-length', str(len(body)))
print req.headers
u = urllib2.urlopen(req)



More information about the Python-list mailing list