Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chianingwang/e155757164f242cce99ece03e3f4adff to your computer and use it in GitHub Desktop.
Save chianingwang/e155757164f242cce99ece03e3f4adff to your computer and use it in GitHub Desktop.
$ python test_conn.py
/tmp/test
REQ: curl -i https://test.swiftstack.org/auth/v1.0 -X GET
RESP STATUS: 200 OK
RESP HEADERS: {u'Content-Length': u'0', u'Set-Cookie': u'X-Auth-Token=AUT...', u'X-Trans-Id': u'tx2243b14f9d3141b08a9cc-005b5260dd', u'X-Auth-Token': u'AUTH_tk5f01bb73e...', u'X-Storage-Token': u'AUTH_tk5f01bb73e...', u'Date': u'Fri, 20 Jul 2018 22:23:25 GMT', u'X-Storage-Url': u'https://test.swiftstack.org/v1/AUTH_test', u'Content-Type': u'text/plain; charset=UTF-8', u'X-Openstack-Request-Id': u'tx2243b14f9d3141b08a9cc-005b5260dd'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/conn_test/test1.txt -X PUT -H "if-none-match: *" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:26 GMT', u'Etag': u'ed3dd25f7a5c84bf2a5adab19b982627', u'X-Trans-Id': u'tx4a1495b95ba045929ffe6-005b5260dd', u'Date': u'Fri, 20 Jul 2018 22:23:28 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx4a1495b95ba045929ffe6-005b5260dd'}
Wrote object test1.txt to Swift in 4.07s
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/conn_test/test2.txt -X PUT -H "if-none-match: *" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:30 GMT', u'Etag': u'bcff6735f39202ab7489e725cecfa86d', u'X-Trans-Id': u'txee7656ec845747fea2461-005b5260e1', u'Date': u'Fri, 20 Jul 2018 22:23:29 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'txee7656ec845747fea2461-005b5260e1'}
Wrote object test2.txt to Swift in 0.55s
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/conn_test/test3.txt -X PUT -H "if-none-match: *" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:30 GMT', u'Etag': u'b6b288f57c3d62596e77c82c2c21bac1', u'X-Trans-Id': u'tx52bed4f12a8040cda0e9a-005b5260e1', u'Date': u'Fri, 20 Jul 2018 22:23:30 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx52bed4f12a8040cda0e9a-005b5260e1'}
Wrote object test3.txt to Swift in 0.61s
copying to swift took: 5.23s
$ python test_service.py
/tmp/test/ [] ['test1.txt', 'test2.txt', 'test3.txt']
files prepared: ['test1.txt', 'test2.txt', 'test3.txt'] at 1532125423.95s
REQ: curl -i https://test.swiftstack.org/auth/v1.0 -X GET
RESP STATUS: 200 OK
RESP HEADERS: {u'Content-Length': u'0', u'Set-Cookie': u'X-Auth-Token=AUT...', u'X-Trans-Id': u'tx6f7f6fdac14c4535aca34-005b5260f0', u'X-Auth-Token': u'AUTH_tk5f01bb73e...', u'X-Storage-Token': u'AUTH_tk5f01bb73e...', u'Date': u'Fri, 20 Jul 2018 22:23:44 GMT', u'X-Storage-Url': u'https://test.swiftstack.org/v1/AUTH_test', u'Content-Type': u'text/plain; charset=UTF-8', u'X-Openstack-Request-Id': u'tx6f7f6fdac14c4535aca34-005b5260f0'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test -X PUT -H "Content-Length: 0" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP HEADERS: {u'Date': u'Fri, 20 Jul 2018 22:23:44 GMT', u'Content-Length': u'0', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx33bba9ac33674bc6b1b4d-005b5260f0', u'X-Trans-Id': u'tx33bba9ac33674bc6b1b4d-005b5260f0'}
{u'action': u'create_container', u'headers': {}, u'container': u'service_test', u'response_dict': {'status': 201, 'headers': {u'date': u'Fri, 20 Jul 2018 22:23:44 GMT', u'content-length': u'0', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx33bba9ac33674bc6b1b4d-005b5260f0', u'x-trans-id': u'tx33bba9ac33674bc6b1b4d-005b5260f0'}, 'reason': 'Created', 'response_dicts': [{'status': 201, 'headers': {u'date': u'Fri, 20 Jul 2018 22:23:44 GMT', u'content-length': u'0', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx33bba9ac33674bc6b1b4d-005b5260f0', u'x-trans-id': u'tx33bba9ac33674bc6b1b4d-005b5260f0'}, 'reason': 'Created'}]}, u'success': True}
REQ: curl -i https://test.swiftstack.org/auth/v1.0 -X GET
REQ: curl -i https://test.swiftstack.org/auth/v1.0 -X GET
RESP STATUS: 200 OK
RESP STATUS: 200 OK
RESP HEADERS: {u'Content-Length': u'0', u'Set-Cookie': u'X-Auth-Token=AUT...', u'X-Trans-Id': u'tx8cf09d4a1e5b419aa6418-005b5260f1', u'X-Auth-Token': u'AUTH_tk5f01bb73e...', u'X-Storage-Token': u'AUTH_tk5f01bb73e...', u'Date': u'Fri, 20 Jul 2018 22:23:45 GMT', u'X-Storage-Url': u'https://test.swiftstack.org/v1/AUTH_test', u'Content-Type': u'text/plain; charset=UTF-8', u'X-Openstack-Request-Id': u'tx8cf09d4a1e5b419aa6418-005b5260f1'}
RESP HEADERS: {u'Content-Length': u'0', u'Set-Cookie': u'X-Auth-Token=AUT...', u'X-Trans-Id': u'txd274fee6cf114861b8974-005b5260f1', u'X-Auth-Token': u'AUTH_tk5f01bb73e...', u'X-Storage-Token': u'AUTH_tk5f01bb73e...', u'Date': u'Fri, 20 Jul 2018 22:23:45 GMT', u'X-Storage-Url': u'https://test.swiftstack.org/v1/AUTH_test', u'Content-Type': u'text/plain; charset=UTF-8', u'X-Openstack-Request-Id': u'txd274fee6cf114861b8974-005b5260f1'}
REQ: curl -i https://test.swiftstack.org/auth/v1.0 -X GET
RESP STATUS: 200 OK
RESP HEADERS: {u'Content-Length': u'0', u'Set-Cookie': u'X-Auth-Token=AUT...', u'X-Trans-Id': u'tx1cebca1dbcc041b591f27-005b5260f1', u'X-Auth-Token': u'AUTH_tk5f01bb73e...', u'X-Storage-Token': u'AUTH_tk5f01bb73e...', u'Date': u'Fri, 20 Jul 2018 22:23:45 GMT', u'X-Storage-Url': u'https://test.swiftstack.org/v1/AUTH_test', u'Content-Type': u'text/plain; charset=UTF-8', u'X-Openstack-Request-Id': u'tx1cebca1dbcc041b591f27-005b5260f1'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test/test1.txt -I -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 404 Not Found
RESP HEADERS: {u'Date': u'Fri, 20 Jul 2018 22:23:45 GMT', u'Content-Length': u'0', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx1e6330c4b07243ffad8de-005b5260f1', u'X-Trans-Id': u'tx1e6330c4b07243ffad8de-005b5260f1'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test/test1.txt -X PUT -H "Content-Length: 36" -H "x-object-meta-mtime: 1532121001.394691" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:46 GMT', u'Etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'X-Trans-Id': u'tx7bc1121efc4a4f3ba298a-005b5260f1', u'Date': u'Fri, 20 Jul 2018 22:23:46 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx7bc1121efc4a4f3ba298a-005b5260f1'}
{u'status': u'uploaded', u'large_object': False, u'container': u'service_test', u'success': True, u'object': u'test1.txt', u'headers': {u'x-object-meta-mtime': u'1532121001.394691'}, u'attempts': 1, u'action': u'upload_object', u'path': '/tmp/test/test1.txt', u'response_dict': {'status': 201, 'headers': {u'content-length': u'0', u'last-modified': u'Fri, 20 Jul 2018 22:23:46 GMT', u'etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'x-trans-id': u'tx7bc1121efc4a4f3ba298a-005b5260f1', u'date': u'Fri, 20 Jul 2018 22:23:46 GMT', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx7bc1121efc4a4f3ba298a-005b5260f1'}, 'reason': 'Created', 'response_dicts': [{'status': 201, 'headers': {u'content-length': u'0', u'last-modified': u'Fri, 20 Jul 2018 22:23:46 GMT', u'etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'x-trans-id': u'tx7bc1121efc4a4f3ba298a-005b5260f1', u'date': u'Fri, 20 Jul 2018 22:23:46 GMT', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx7bc1121efc4a4f3ba298a-005b5260f1'}, 'reason': 'Created'}]}}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test/test2.txt -I -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 404 Not Found
RESP HEADERS: {u'Date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'Content-Length': u'0', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'txf365b8c81480454b97600-005b5260f1', u'X-Trans-Id': u'txf365b8c81480454b97600-005b5260f1'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test/test3.txt -I -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 404 Not Found
RESP HEADERS: {u'Date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'Content-Length': u'0', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'txe587b464d73248d781799-005b5260f1', u'X-Trans-Id': u'txe587b464d73248d781799-005b5260f1'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test/test3.txt -X PUT -H "Content-Length: 36" -H "x-object-meta-mtime: 1532121035.473536" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/service_test/test2.txt -X PUT -H "Content-Length: 36" -H "x-object-meta-mtime: 1532121032.576181" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP STATUS: 201 Created
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:48 GMT', u'Etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'X-Trans-Id': u'tx2d235b72ee954c0a9110d-005b5260f3', u'Date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx2d235b72ee954c0a9110d-005b5260f3'}
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:48 GMT', u'Etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'X-Trans-Id': u'tx0afbc4558b9e4dcd99917-005b5260f3', u'Date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'tx0afbc4558b9e4dcd99917-005b5260f3'}
{u'status': u'uploaded', u'large_object': False, u'container': u'service_test', u'success': True, u'object': u'test3.txt', u'headers': {u'x-object-meta-mtime': u'1532121035.473536'}, u'attempts': 1, u'action': u'upload_object', u'path': '/tmp/test/test3.txt', u'response_dict': {'status': 201, 'headers': {u'content-length': u'0', u'last-modified': u'Fri, 20 Jul 2018 22:23:48 GMT', u'etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'x-trans-id': u'tx2d235b72ee954c0a9110d-005b5260f3', u'date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx2d235b72ee954c0a9110d-005b5260f3'}, 'reason': 'Created', 'response_dicts': [{'status': 201, 'headers': {u'content-length': u'0', u'last-modified': u'Fri, 20 Jul 2018 22:23:48 GMT', u'etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'x-trans-id': u'tx2d235b72ee954c0a9110d-005b5260f3', u'date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx2d235b72ee954c0a9110d-005b5260f3'}, 'reason': 'Created'}]}}
{u'status': u'uploaded', u'large_object': False, u'container': u'service_test', u'success': True, u'object': u'test2.txt', u'headers': {u'x-object-meta-mtime': u'1532121032.576181'}, u'attempts': 1, u'action': u'upload_object', u'path': '/tmp/test/test2.txt', u'response_dict': {'status': 201, 'headers': {u'content-length': u'0', u'last-modified': u'Fri, 20 Jul 2018 22:23:48 GMT', u'etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'x-trans-id': u'tx0afbc4558b9e4dcd99917-005b5260f3', u'date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx0afbc4558b9e4dcd99917-005b5260f3'}, 'reason': 'Created', 'response_dicts': [{'status': 201, 'headers': {u'content-length': u'0', u'last-modified': u'Fri, 20 Jul 2018 22:23:48 GMT', u'etag': u'b32ff06838cb19dc773b6ced72a8ed03', u'x-trans-id': u'tx0afbc4558b9e4dcd99917-005b5260f3', u'date': u'Fri, 20 Jul 2018 22:23:47 GMT', u'content-type': u'text/html; charset=UTF-8', u'x-openstack-request-id': u'tx0afbc4558b9e4dcd99917-005b5260f3'}, 'reason': 'Created'}]}}
ERROR:root:message
None
files: ['test1.txt', 'test2.txt', 'test3.txt'] upload took: 4.00s
copying to swift took: 4.00s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment