1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import httplib
class GrackleClient:
def __init__(self, host, port):
self.host = host
self.port = port
def put_message(self, archive_name, permalink, file_obj):
connection = httplib.HTTPConnection(self.host, self.port)
connection.request('PUT', permalink, file_obj.read())
response = connection.getresponse()
data = response.read()
if response.status == httplib.BAD_REQUEST:
raise Exception('wtf')
elif response.status == httplib.CREATED:
return
else:
raise Exception('!!')
|