phantom_install.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:SerpScrap 作者: ecoron 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号