Client side HTTPPUT requests are very similar to POST requests. The difference lies only the server side where HTTP server will allow resources to be created via PUT request. Here is an example session that shows how to do PUT request using httplib:
>>>
>>> # This creates an HTTP message>>> # with the content of BODY as the enclosed representation>>> # for the resource http://localhost:8080/foobar...>>> importhttplib>>> BODY="***filecontents***">>> conn=httplib.HTTPConnection("localhost",8080)>>> conn.request("PUT","/file",BODY)>>> response=conn.getresponse()>>> printresponse.status,response.reason200, OK
Here is an example session that uses the GET method:>>>>>> import httplib>>> conn = httplib.HTTPConnection("www.python.org")>>> conn.request("GET", "/index.html")>>> r1 = conn.getresponse()>