sites.py 文件源码

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

项目:download-npo 作者: Carpetsmoker 项目源码 文件源码
def urlopen(self, url):  # pylint:disable=no-self-use
        """ Open a URI; return urllib.request.Request object """
        if download_npo.verbose:
            msg('urlopen: ' + url)

        headers = {
            'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0',
            'Cookie': 'npo_cc=tmp; npo_cc_www.npogeschiedenis.nl=tmp',
        }
        req = urllib2.Request(url, headers=headers)
        try:
            return urllib2.urlopen(req)
        except urllib2.HTTPError:
            raise download_npo.Error(
                'De URL {} is niet gevonden (404 error)'.format(url))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号