Use urllib3 for driver downloads

This commit is contained in:
Michael Mintz 2018-08-30 02:56:51 -04:00
parent 2a42c5b334
commit 765e64d6fb
3 changed files with 6 additions and 5 deletions

View File

@ -12,6 +12,7 @@ requests==2.19.1
beautifulsoup4==4.6.0
unittest2==1.1.0
chardet==3.0.4
urllib3==1.23
boto==2.48.0
ipdb==0.11
parameterized==0.6.1

View File

@ -19,12 +19,10 @@ import requests
import shutil
import sys
import tarfile
import urllib3
import zipfile
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
if sys.version_info[0] == 2:
from urllib import urlopen
else:
from urllib.request import urlopen
urllib3.disable_warnings()
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
@ -190,7 +188,8 @@ def main():
if not os.path.exists(downloads_folder):
os.mkdir(downloads_folder)
local_file = open(file_path, 'wb')
remote_file = urlopen(download_url)
http = urllib3.PoolManager()
remote_file = http.request('GET', download_url, preload_content=False)
print('\nDownloading %s from:\n%s ...' % (file_name, download_url))
local_file.write(remote_file.read())
local_file.close()

View File

@ -59,6 +59,7 @@ setup(
'beautifulsoup4==4.6.0',
'unittest2==1.1.0',
'chardet==3.0.4',
'urllib3==1.23',
'boto==2.48.0',
'ipdb==0.11',
'parameterized==0.6.1',