paulengstler/glacier — pull request #7 by davidbernick (2012-09-11 00:19:51+00:00)
Title: Changes that we discussed briefly (tested)

Mostly changed how jobs are submitted/described from AWS in vault.py and request.py.

For vault.py, 201 and 200 are both legitimate responses for describe_job. I took care of that.

For request.py, I changed to this (basically changed the actual request to be inside the conditionals).
```
def send_request(self):

# Because of the variety of hashes that need to be processed in the
# Authorization header it will be baked last.
self.header["Authorization"] = self.build_authorization_header()
# Always via HTTPS!
connection = httplib.HTTPSConnection(self.host)
# uncomment if you want to debug the network i/o
# connection.set_debuglevel(1)
connection.connect()

if isinstance(self.body,file):
connection.request(self.method,self.path,"",self.header)
# stream the file in 10 MB chunks to keep the memory usage low
self.body.seek(0)
chunk_size = int(1024*1024*10)
file_size = float(os.fstat(self.body.fileno()).st_size)
chunk_count = int(math.ceil(file_size/float(chunk_size)))
for _ in range(chunk_count):
connection.send(self.body.read(chunk_size))
else:
# send the full string
#connection.send(self.body)
connection.request(self.method,self.path,self.body,self.header)
return connection.getresponse()

```