# Path: chartmogul/api/config.py
# class Config:
#     uri = API_BASE + "/" + VERSION
# 
#     def __init__(self, api_key, request_timeout=None, max_retries=20, backoff_factor=2):
#         self.auth = (api_key, '')
#         self.request_timeout = request_timeout
#         self.max_retries = max_retries
#         self.backoff_factor = backoff_factor
# 
# Path: chartmogul/errors.py
# class ArgumentMissingError(Exception):
#     pass
# 
# class ConfigurationError(Exception):
#     pass
# 
# def annotateHTTPError(err):
#     if isinstance(err, HTTPError):
#         raise_from(APIError(err.response.content), err)
#     else:
#         raise err
# 
# Path: chartmogul/retry_request.py
# def requests_retry_session(retries=20, backoff_factor=2, session=None,):
#     session = session or requests.Session()
#     adapter = _retry_adapter(retries, backoff_factor)
#     session.mount('https://', adapter)
#     return session


from datetime import date, datetime
from json import dumps
from promise import Promise
from uritemplate import URITemplate
from .api.config import Config
from .errors import ArgumentMissingError, ConfigurationError, annotateHTTPError
from .retry_request import requests_retry_session
from .version import __version__
                getattr(
                    requests_retry_session(
                        config.max_retries,
                        config.backoff_factor),
                    http_verb)(
                    config.uri + path,
                    data=data,
                    headers={
                        'content-type': 'application/json', 'User-Agent': 'chartmogul-python/' + __version__},
                    params=params,
                    auth=config.auth,
                    timeout=config.request_timeout))).then(
            cls._load).catch(annotateHTTPError)

    @classmethod
    def _expandPath(cls, path, kwargs):
        t = URITemplate(path)
        return t.expand(kwargs)

    @classmethod
    def _validate_arguments(cls, method, kwargs):
        # This enforces user to pass argument, otherwise we could call
        # wrong URL.
        if method in [
            'destroy',
            'cancel',
            'retrieve',
                'update'] and 'uuid' not in kwargs:
            raise ArgumentMissingError("Please pass 'uuid' parameter")
        if method in ['create', 'modify'] and 'data' not in kwargs:

# Path: chartmogul/api/config.py
# class Config:
#     uri = API_BASE + "/" + VERSION
# 
#     def __init__(self, api_key, request_timeout=None, max_retries=20, backoff_factor=2):
#         self.auth = (api_key, '')
#         self.request_timeout = request_timeout
#         self.max_retries = max_retries
#         self.backoff_factor = backoff_factor
# 
# Path: chartmogul/errors.py
# class ArgumentMissingError(Exception):
#     pass
# 
# class ConfigurationError(Exception):
#     pass
# 
# def annotateHTTPError(err):
#     if isinstance(err, HTTPError):
#         raise_from(APIError(err.response.content), err)
#     else:
#         raise err
# 
# Path: chartmogul/retry_request.py
# def requests_retry_session(retries=20, backoff_factor=2, session=None,):
#     session = session or requests.Session()
#     adapter = _retry_adapter(retries, backoff_factor)
#     session.mount('https://', adapter)
#     return session


# Path: chartmogul/resource.py
from datetime import date, datetime
from json import dumps
from promise import Promise
from uritemplate import URITemplate
from .api.config import Config
from .errors import ArgumentMissingError, ConfigurationError, annotateHTTPError
from .retry_request import requests_retry_session
from .version import __version__

                getattr(
                    requests_retry_session(
                        config.max_retries,
                        config.backoff_factor),
                    http_verb)(
                    config.uri + path,
                    data=data,
                    headers={
                        'content-type': 'application/json', 'User-Agent': 'chartmogul-python/' + __version__},
                    params=params,
                    auth=config.auth,
                    timeout=config.request_timeout))).then(
            cls._load).catch(annotateHTTPError)

    @classmethod
    def _expandPath(cls, path, kwargs):
        t = URITemplate(path)
        return t.expand(kwargs)

    @classmethod
    def _validate_arguments(cls, method, kwargs):
        # This enforces user to pass argument, otherwise we could call
        # wrong URL.
        if method in [
            'destroy',
            'cancel',
            'retrieve',
                'update'] and 'uuid' not in kwargs:
            raise ArgumentMissingError("Please pass 'uuid' parameter")
        if method in ['create', 'modify'] and 'data' not in kwargs:

            raise ArgumentMissingError("Please pass 'data' parameter")