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


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



log = logging.getLogger(__name__)

__all__ = ['DefaultHeadersMiddleware']


class DefaultHeadersMiddleware:
    def __init__(self, default_headers=None):
        self._headers = default_headers or {}

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

    @classmethod
    def from_crawler(cls, crawler):
        default_headers = crawler.config.get("default_headers")
        if default_headers is None:

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


# Path: xpaw/extensions/header.py
import logging
from xpaw.errors import NotEnabled

# coding=utf-8



log = logging.getLogger(__name__)

__all__ = ['DefaultHeadersMiddleware']


class DefaultHeadersMiddleware:
    def __init__(self, default_headers=None):
        self._headers = default_headers or {}

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

    @classmethod
    def from_crawler(cls, crawler):
        default_headers = crawler.config.get("default_headers")
        if default_headers is None:

            raise NotEnabled