0

I'm uploading files through poster using urllib2.Request.

Is there anyway to use the progressbar library with uploading?

import urllib2
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
# from progressbar import ProgressBar

register_openers()
datagen, headers = multipart_encode({"file": open(upfile, "rb")}) #has content-length
#progress = ProgressBar()
#for i in progress(range(80)):
#   time.sleep(0.01)
request = urllib2.Request(url, datagen, headers)
# File uploaded, get completed page
urllib2.urlopen(request).read()
4ae1e1
  • 6,750
  • 7
  • 42
  • 73
user1043816
  • 139
  • 1
  • 4
  • 13
  • There's no progressbar library in stdlib, I guess you mean https://pypi.python.org/pypi/progressbar ? Please make that clear. By the way, I always roll my own progress bar classes. – 4ae1e1 Apr 10 '15 at 21:25
  • Added links to both poster and progressbar to be more clear. – user1043816 Apr 10 '15 at 21:28
  • I think you should also include your `import` statements so that people can at least run your code. I don't think `poster` is a very well known package. – 4ae1e1 Apr 10 '15 at 21:32
  • anyone with the answer ? – dunstorm Jan 19 '17 at 04:56

0 Answers0