Skip to content

Instantly share code, notes, and snippets.

@garnaat
Created June 7, 2012 17:48
Show Gist options
  • Save garnaat/2890351 to your computer and use it in GitHub Desktop.
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
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
@prasannaezest
Copy link

prasannaezest commented Jul 27, 2016

how can i get "so_far, total" variables value in html template please suggest..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment