# Path: xpaw/errors.py
# class NotEnabled(Exception):
#     """
#     Not enabled.
#     """


import logging
from urllib.parse import urlsplit
from xpaw.errors import NotEnabled
# coding=utf-8



log = logging.getLogger(__name__)

__all__ = ['ProxyMiddleware']


class ProxyMiddleware:
    def __init__(self, proxy):
        self._proxies = {'http': None, 'https': None}
        self._set_proxy(proxy)

    def __repr__(self):
        cls_name = self.__class__.__name__
        return '{}(proxy={})'.format(cls_name, repr(self._proxies))

    @classmethod
    def from_crawler(cls, crawler):
        proxy = crawler.config.get('proxy')
        if not proxy:

# Path: xpaw/errors.py
# class NotEnabled(Exception):
#     """
#     Not enabled.
#     """


# Path: xpaw/extensions/proxy.py
import logging
from urllib.parse import urlsplit
from xpaw.errors import NotEnabled

# coding=utf-8



log = logging.getLogger(__name__)

__all__ = ['ProxyMiddleware']


class ProxyMiddleware:
    def __init__(self, proxy):
        self._proxies = {'http': None, 'https': None}
        self._set_proxy(proxy)

    def __repr__(self):
        cls_name = self.__class__.__name__
        return '{}(proxy={})'.format(cls_name, repr(self._proxies))

    @classmethod
    def from_crawler(cls, crawler):
        proxy = crawler.config.get('proxy')
        if not proxy:

            raise NotEnabled