def download(self):
logger.info('downloading phantomjs')
this_os = self.get_os().lower()
base_url = 'https://bitbucket.org/ariya/phantomjs/downloads/'
if 'windows' in this_os:
file_name = 'phantomjs-2.1.1-windows.zip'
archive = 'zip'
elif 'linux' in this_os:
archive = 'tar.bz2'
if sys.maxsize > 2 ** 32:
file_name = 'phantomjs-2.1.1-linux-x86_64.tar.bz2'
else:
file_name = 'phantomjs-2.1.1-linux-i686.tar.bz2'
else:
raise Exception('''
Platform not supported.
install phantomjs manualy and update the path in your config
''')
# Download the file from `url` and save it locally under `file_name`:
urllib.request.urlretrieve(base_url + file_name, '/tmp/' + file_name)
self.unpack('/tmp/' + file_name, archive)
评论列表
文章目录