完全按照老师写的代码报错twisted.web.error.SchemeNotSupported: Unsupported scheme: b''

来源:2-9 ip代理中间件编写

qq_半字浅眉_1

2018-10-15 20:27

class my_proxy(object):
    def process_request(self,request,spider):
        request.meta['proxy']='http-cla.abuyun.com:9030'
        proxy_name_pass=b'H211EATS905745KC:F8FFBC929EB7D5A7'
        encode_pass_name=base64.b64encode(proxy_name_pass)
        request.headers['Proxy-Authorization']='Basic '+encode_pass_name.decode()


写回答 关注

7回答

  • sofeng
    2019-01-04 13:33:47
        import base64    # 代理服务器
        proxyServer = "http://http-dyn.abuyun.com:9020"
        # 代理隧道验证信息
        proxyUser = "xxxxxx"
        proxyPass = "xxxxxx"
        # for Python2
        proxyAuth = "Basic " + base64.b64encode(proxyUser + ":" + proxyPass)
        # for Python3
        #proxyAuth = "Basic " + base64.urlsafe_b64encode(bytes((proxyUser + ":" + proxyPass), "ascii")).decode("utf8")
    
        class ProxyMiddleware(object):
            def process_request(self, request, spider):
                request.meta["proxy"] = proxyServer
                request.headers["Proxy-Authorization"] = proxyAuth


  • CasparMa
    2018-12-18 16:41:50
    request.meta['Proxy'] = 'http-pro.abuyun.com:9010',在http-pro.abuyun.com:9030前面加上http://就可以了


  • CasparMa
    2018-12-18 16:40:23
    request.meta['Proxy'] = 'http-pro.abuyun.com:9010'

    改成

    request.meta['Proxy'] = ',问题解决


    weixin...

    什么鬼,你这等号右边为啥只有一个引号,而且这应该是没有用到代理ip把?

    2019-04-12 18:28:16

    共 1 条回复 >

  • 慕容0352477
    2018-11-29 15:01:47
    request.meta['Proxy'] = 'http-pro.abuyun.com:9010'

    我是把‘proxy'改为'Proxy'后好像可以了

    笨笨机器人

    同样+1

    2019-02-18 19:55:38

    共 2 条回复 >

  • qq_夜北孤星_0
    2018-10-23 17:55:34

    ERROR: Error downloading <GET https://movie.douban.com/top250>: Could not open CONNECT tunnel with proxy http-cla.abuyun.com:9030 [{'status': 407, 'reason': b'Proxy Authentication Required'}]这个怎么解决

    Chenfo...

    连接不上去了

    2018-11-05 13:06:56

    共 2 条回复 >

  • xusiman
    2018-10-17 10:47:36

    那不清楚了,我以为是加b错误

    weixin... 回复qq_夜北孤...

    +1,你解决了吗?

    2019-04-12 18:27:04

    共 2 条回复 >

  • xusiman
    2018-10-17 10:10:54

    你python是哪个版本

    qq_半字浅...

    python3.6

    2018-10-17 10:33:05

    共 1 条回复 >

Python最火爬虫框架Scrapy入门与实践

做为爬虫工程师Python Scrapy主流爬虫框架你必须要会!

67418 学习 · 223 问题

查看课程

相似问题