问答详情
源自:2-9 ip代理中间件编写

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

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()


提问者:qq_半字浅眉_1 2018-10-15 20:27

个回答

  • 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'] = ',问题解决


  • 慕容0352477
    2018-11-29 15:01:47

    request.meta['Proxy'] = 'http-pro.abuyun.com:9010'

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

  • 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'}]这个怎么解决

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

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

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

    你python是哪个版本