Skip to content

Use requests instead of urllib3 for webdriver downloads #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ before_install:
install:
- "pip install --upgrade pip"
- "pip install -r requirements.txt --upgrade"
- "pip install mysqlclient==1.3.14"
- "pip install mysqlclient==1.4.2"
- "python setup.py develop"
- "sudo rm -f /etc/boto.cfg"
before_script:
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ipdb
chardet
unittest2
selenium==3.141.0
requests==2.21.0
urllib3==1.24.2
requests>=2.21.0
pytest>=4.4.1
pytest-cov>=2.6.1
pytest-forked>=1.0.2
Expand All @@ -18,9 +18,9 @@ pytest-xdist>=1.28.0
pytest-ordering>=0.6
parameterized>=0.7.0
beautifulsoup4>=4.6.0
colorama==0.4.1
colorama>=0.4.1
pyotp>=2.2.7
boto>=2.49.0
flake8==3.7.7
PyVirtualDisplay==0.2.1
flake8>=3.7.7
PyVirtualDisplay>=0.2.1
-e .
12 changes: 4 additions & 8 deletions seleniumbase/console_scripts/sb_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
import os
import platform
import requests
import urllib3 # Some systems don't have requests.packages.urllib3
import shutil
import sys
import tarfile
import zipfile
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
urllib3.disable_warnings()
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))


Expand Down Expand Up @@ -186,13 +184,11 @@ def main():
file_path = downloads_folder + '/' + file_name
if not os.path.exists(downloads_folder):
os.mkdir(downloads_folder)
local_file = open(file_path, 'wb')
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()
remote_file.close()
remote_file = requests.get(download_url)
with open(file_path, 'wb') as file:
file.write(remote_file.content)
print('Download Complete!\n')

if file_name.endswith(".zip"):
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

setup(
name='seleniumbase',
version='1.23.3',
version='1.23.4',
description='Reliable Browser Automation & Testing Framework',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down Expand Up @@ -59,8 +59,8 @@
'chardet',
'unittest2',
'selenium==3.141.0',
'requests==2.21.0', # Changing this may effect "urllib3"
'urllib3>=1.24.2,<1.25.0', # Keep this lib in sync with "requests"
'urllib3==1.24.2',
'requests>=2.21.0',
'pytest>=4.4.1',
'pytest-cov>=2.6.1',
'pytest-forked>=1.0.2',
Expand All @@ -71,11 +71,11 @@
'pytest-ordering>=0.6',
'parameterized>=0.7.0',
'beautifulsoup4>=4.6.0', # Keep at >=4.6.0 while using bs4
'colorama==0.4.1',
'colorama>=0.4.1',
'pyotp>=2.2.7',
'boto>=2.49.0',
'flake8>=3.6.0,<3.8.0',
'PyVirtualDisplay==0.2.1',
'flake8>=3.7.7',
'PyVirtualDisplay>=0.2.1',
],
packages=[
'seleniumbase',
Expand Down