Revision aac2ec74036ade927716f8fb3d6ebaf9ca16ac72 authored by Alex Feinberg on 09 June 2010, 10:19:13 UTC, committed by Alex Feinberg on 11 June 2010, 01:18:37 UTC
1 parent 08442a2
rest.py
import httplib
def get(host, path, port = 80):
con = httplib.HTTPConnection(host, port)
con.request('GET', path)
response = con.getresponse()
contents = response.read()
con.close()
return response.status, contents
def post(host, path, data, port = 80):
con = httplib.HTTPConnection(host, port)
con.request('POST', path, data)
response = con.getresponse()
contents = response.read()
con.close()
return response.status, contents
def put(host, path, data, port = 80):
con = httplib.HTTPConnection(host, port)
con.request('PUT', path, data)
response = con.getresponse()
contents = response.read()
con.close()
return response.status, contents
def delete(host, path, port = 80):
con = httplib.HTTPConnection(host, port)
con.request('DELETE', path)
response = con.getresponse()
contents = response.read()
con.close()
return response.status, contents
def options(host, path, port = 80):
con = httplib.HTTPConnection(host, port)
con.request('OPTIONS', path)
response = con.getresponse()
contents = response.read()
con.close()
return response.status, contents
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...