Commit 367fda97 authored by Ilija Radosavovic's avatar Ilija Radosavovic Committed by Facebook Github Bot

Make response size computation py3 compatible

Reviewed By: ashwinb

Differential Revision: D10218305

fbshipit-source-id: d9d285959b1e4f5c0d38f080d6ce8c260b1959e0
parent 96147dec
...@@ -136,7 +136,10 @@ def download_url( ...@@ -136,7 +136,10 @@ def download_url(
https://stackoverflow.com/questions/2028517/python-urllib2-progress-hook https://stackoverflow.com/questions/2028517/python-urllib2-progress-hook
""" """
response = urllib.request.urlopen(url) response = urllib.request.urlopen(url)
total_size = response.info().getheader('Content-Length').strip() if six.PY2:
total_size = response.info().getheader('Content-Length').strip()
else:
total_size = response.info().get('Content-Length').strip()
total_size = int(total_size) total_size = int(total_size)
bytes_so_far = 0 bytes_so_far = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment