Open bousqi opened 5 years ago
I managed to make a quick and DIRTY, MEGA DIRTY workaround. If someone is inspired to make something better :
def download(url, target_dir,
message_consumer=sys.stdout.write, mode='resume'):
"""."""
is_done = False
trunk_size = 1024
done_size = 0
is_msg_quiet = True
file_name = os.path.basename(url)
target_file_path = os.path.join(target_dir, file_name)
tmp_file_path = target_file_path + '.stino-down'
proxies = {'http': 'http://IP.IP.IP.IP:PORT',
'https': 'https://IP.IP.IP.IP:PORT'}
proxy_handler = urllib.request.ProxyHandler(proxies)
opener = urllib.request.build_opener(proxy_handler)
urllib.request.install_opener(opener)
remote_info = get_remote_file_info(url)
remote_size = int(remote_info.get('Content-Length', '0'))
Main issue with that solution is that it can't work with HTTPS urls as a install_opener will replace the proxy handler.
I'm facing issue to use Stino Package as my computer must pass through a proxy. When I pick a board after the installation, the package tries to fetch all missing dependencies but without any success :
In fact, it internally fails. Is there any simple solution to add proxy support ?
I've been looking into package sources, and I feel (not sure at all) that downloader.py must be modified to fix it.