-
-
Save chrishamant/1556467 to your computer and use it in GitHub Desktop.
An IPython transcript showing use of S3 MultiPart Upload in boto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import boto | |
In [2]: c = boto.connect_s3() | |
In [3]: b = c.lookup('test-1245812163') | |
In [4]: mp = b.initiate_multipart_upload('testmpupload2') | |
In [5]: mp | |
Out[5]: <MultiPartUpload testmpupload2> | |
In [6]: fp = open('xaa', 'rb') | |
In [7]: mp.upload_part_from_file(fp, 1) | |
In [8]: fp.close() | |
In [9]: fp = open('xab', 'rb') | |
In [10]: mp.upload_part_from_file(fp, 2) | |
In [11]: fp.close() | |
In [12]: fp = open('xac', 'rb') | |
In [13]: mp.upload_part_from_file(fp, 3) | |
In [14]: fp.close() | |
In [15]: fp = open('xad', 'rb') | |
In [16]: mp.upload_part_from_file(fp, 4) | |
In [17]: fp.close() | |
In [18]: for part in mp: | |
....: print part.part_number, part.size | |
....: | |
1 5242880 | |
2 5242880 | |
3 5242880 | |
4 1505917 | |
In [19]: mp.complete_upload() | |
In [20]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment