Created
June 7, 2012 17:48
-
-
Save garnaat/2890351 to your computer and use it in GitHub Desktop.
Use the callback parameter to watch progress of an upload to S3 via 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('stats.pythonboto.org') | |
In [4]: k = b.new_key('test1234') | |
In [5]: def mycb(so_far, total): | |
...: print '%d bytes transferred out of %d' % (so_far, total) | |
...: | |
In [6]: k.set_contents_from_filename('detail.html', cb=mycb, num_cb=10) | |
0 bytes transferred out of 19837 | |
8192 bytes transferred out of 19837 | |
16384 bytes transferred out of 19837 | |
19837 bytes transferred out of 19837 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how can i get "so_far, total" variables value in html template please suggest..