# Buggy code
def to_dict(self):
    return {
        "Action": "InventoryRetrieval",
        "ArchiveId": self.archive_id,
        "ArchiveSizeInBytes": 0,
        "ArchiveSHA256TreeHash": None,
        "Completed": True,
        "CompletionDate": "2013-03-20T17:03:43.221Z",
        "CreationDate": "2013-03-20T17:03:43.221Z",
        "InventorySizeInBytes": "0",
        "JobDescription": None,
        "JobId": self.job_id,
        "RetrievalByteRange": None,
        "SHA256TreeHash": None,
        "SNSTopic": None,
        "StatusCode": "Succeeded",
        "StatusMessage": None,
        "VaultARN": None,
    }


# Traceback (AttributeError)
127.0.0.1 - - [06/Sep/2017 14:40:32] "POST /kefo/vaults/testvault/archives HTTP/1.1" 500 -
Error on request:
Traceback (most recent call last):
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/werkzeug/serving.py", line 209, in run_wsgi
execute(self.server.app)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/werkzeug/serving.py", line 197, in execute
application_iter = app(environ, start_response)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/server.py", line 92, in __call__
return backend_app(environ, start_response)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/core/utils.py", line 131, in __call__
result = self.callback(request, request.url, {})
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/glacier/responses.py", line 71, in vault_archive_response
return response_instance._vault_archive_response(request, full_url, headers)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/glacier/responses.py", line 75, in _vault_archive_response
body = request.body
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'body'

# Fixed code
def to_dict(self):
    d = {
        "Action": "ArchiveRetrieval",
        "ArchiveId": self.archive_id,
        "ArchiveSizeInBytes": 0,
        "ArchiveSHA256TreeHash": None,
        "Completed": False,
        "CreationDate": self.st.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
        "InventorySizeInBytes": 0,
        "JobDescription": None,
        "JobId": self.job_id,
        "RetrievalByteRange": None,
        "SHA256TreeHash": None,
        "SNSTopic": None,
        "StatusCode": "InProgress",
        "StatusMessage": None,
        "VaultARN": self.arn,
        "Tier": self.tier,
    }
    if datetime.datetime.now() > self.et:
        d["Completed"] = True
        d["CompletionDate"] = self.et.strftime("%Y-%m-%dT%H:%M:%S.000Z")
        d["InventorySizeInBytes"] = 10000
        d["StatusCode"] = "Succeeded"
    return d