# Path: statik/errors.py
# class ProjectConfigurationError(StatikError):
#     """For generic project configuration-related errors."""
#     error_kind = "Project configuration error"
#     exit_code = 2
# 
# class DeploymentError(StatikError):
#     """For errors relating to deployment of built projects."""
#     error_kind = "Deployment-related error"
#     exit_code = 9
# 
# Path: statik/deploy/base.py
# class DeploymentMethod(object):
#     """An abstract method for handling deployment."""
# 
#     def __init__(self, config, error_context=None):
#         """Must validate the given configuration for this deployment method and raise an exception
#         if it's invalid."""
#         raise NotImplementedError
# 
#     def execute(self, source_path):
#         """Must actually execute the implemented deployment method."""
#         raise NotImplementedError


import os
import os.path
import requests
import hashlib
import time
import json
import logging
from collections import OrderedDict, namedtuple
from datetime import datetime
from dateutil.parser import parse as dateutil_parse
from urllib.parse import quote as urllib_quote
from ..errors import ProjectConfigurationError, DeploymentError
from .base import DeploymentMethod
                continue
            for df in dfs:
                self.netlify_upload_file(deployment['id'], df)

        logger.info("Netlify deployment up-to-date")


    def netlify_get(self, path):
        return requests.get(
            NETLIFY_API_ROOT + path,
            headers={'Authorization': 'Bearer %s' % self.auth_token},
        )

    def netlify_post(self, path, data):
        return requests.post(
            NETLIFY_API_ROOT + path,
            json=data,
            headers={'Authorization': 'Bearer %s' % self.auth_token},
        )

    def netlify_create_deployment(self, hashes_by_filename):
        payload = {'files': OrderedDict(), 'async': True}
        for filename, df in hashes_by_filename.items():
            payload['files'][filename] = df.sha1sum
        logger.debug("Attempting to send deployment data:\n%s" % json.dumps(payload, indent=2))
        resp = self.netlify_post(
            '/sites/%s/deploys' % self.site_id,
            payload,
        )
        if resp.status_code >= 400:

# Path: statik/errors.py
# class ProjectConfigurationError(StatikError):
#     """For generic project configuration-related errors."""
#     error_kind = "Project configuration error"
#     exit_code = 2
# 
# class DeploymentError(StatikError):
#     """For errors relating to deployment of built projects."""
#     error_kind = "Deployment-related error"
#     exit_code = 9
# 
# Path: statik/deploy/base.py
# class DeploymentMethod(object):
#     """An abstract method for handling deployment."""
# 
#     def __init__(self, config, error_context=None):
#         """Must validate the given configuration for this deployment method and raise an exception
#         if it's invalid."""
#         raise NotImplementedError
# 
#     def execute(self, source_path):
#         """Must actually execute the implemented deployment method."""
#         raise NotImplementedError


# Path: statik/deploy/netlify.py
import os
import os.path
import requests
import hashlib
import time
import json
import logging
from collections import OrderedDict, namedtuple
from datetime import datetime
from dateutil.parser import parse as dateutil_parse
from urllib.parse import quote as urllib_quote
from ..errors import ProjectConfigurationError, DeploymentError
from .base import DeploymentMethod

                continue
            for df in dfs:
                self.netlify_upload_file(deployment['id'], df)

        logger.info("Netlify deployment up-to-date")


    def netlify_get(self, path):
        return requests.get(
            NETLIFY_API_ROOT + path,
            headers={'Authorization': 'Bearer %s' % self.auth_token},
        )

    def netlify_post(self, path, data):
        return requests.post(
            NETLIFY_API_ROOT + path,
            json=data,
            headers={'Authorization': 'Bearer %s' % self.auth_token},
        )

    def netlify_create_deployment(self, hashes_by_filename):
        payload = {'files': OrderedDict(), 'async': True}
        for filename, df in hashes_by_filename.items():
            payload['files'][filename] = df.sha1sum
        logger.debug("Attempting to send deployment data:\n%s" % json.dumps(payload, indent=2))
        resp = self.netlify_post(
            '/sites/%s/deploys' % self.site_id,
            payload,
        )
        if resp.status_code >= 400:

            raise DeploymentError("Failed to create Netlify deployment: %s" % resp.text)