3
def put_message(archive_name, file_obj):
4
connection = httplib.HTTPConnection('localhost', 8435)
5
connection.request('POST', '/archive/%s' % archive_name, file_obj.read())
6
response = connection.getresponse()
8
if response.status == httplib.BAD_REQUEST:
10
elif response.status == httplib.CREATED:
6
def __init__(self, host, port):
10
def put_message(self, archive_name, permalink, file_obj):
11
connection = httplib.HTTPConnection(self.host, self.port)
12
connection.request('PUT', permalink, file_obj.read())
13
response = connection.getresponse()
14
data = response.read()
15
if response.status == httplib.BAD_REQUEST:
16
raise Exception('wtf')
17
elif response.status == httplib.CREATED: