def _parse(r): if r.OK: object_name = r.request._object.get_name() obj = Object(name=object_name) obj.set_remote_hash(r.headers.get('ETag', '')) obj.set_content_type(r.headers.get('Content-Type', '')) obj.set_remote_lenth(r.headers.get('Content-Length', 0)) obj.set_data(r.body) d.callback((r, obj)) elif r.status_code == 401: d.errback(NotAuthenticatedException('failed to delete object, not authorised')) elif r.status_code == 404: d.errback(ResponseException('failed to delete object, object does not exist')) else: d.errback(ResponseException('failed to delete object'))