# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/constants.py
# STRING = (str, unicode)
# 
# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/functions.py
# def partial(func, *args, **keywords):
#     def newfunc(*fargs, **fkeywords):
#         newkeywords = keywords.copy()
#         newkeywords.update(fkeywords)
#         return func(*(args + fargs), **newkeywords)
#     newfunc.func = func
#     newfunc.args = args
#     newfunc.keywords = keywords
#     return newfunc
# 
# def url_safe(s):
#     if isinstance(s, STRING):
#         if PY2:
#             s = urllib.quote(s, '')
#         else:
#             s = urllib.parse.quote(s, '')
#     return s
# 
# def utf8(s):
#     if not isinstance(s, str):
#         s = s.encode('utf-8')
#     return s
# 
# def import_httplib():
#     try:
#         import httplib
#     except ImportError:
#         import http.client as httplib
#     return httplib


import datetime
from .constants import STRING
from .functions import partial, url_safe, utf8, import_httplib


httplib = import_httplib()

class RequestClient(object):
    '''
    A simple http client implement.
    '''
    methods = ['GET', 'POST', 'PUT', 'DELETE', 'HEAD']

    def __init__(self, host, port):
        self.h, self.p = (host, port)
        self.c = httplib.HTTPConnection(self.h, self.p)

    def send_request(self, method, path='', params={}, headers={}, body=''):
        # Start args validate sections.
        assert path and isinstance(path, STRING), 'path must be str and may not be Empty'
        assert not params or isinstance(params, dict), 'params must be dict or None'
        assert not params or isinstance(headers, dict), 'headers must be dict or None'
        if method in ['GET', 'HEAD', 'DELETE']:
            assert not params, 'body is not allowed for method'%(metdod)
        else:

# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/constants.py
# STRING = (str, unicode)
# 
# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/functions.py
# def partial(func, *args, **keywords):
#     def newfunc(*fargs, **fkeywords):
#         newkeywords = keywords.copy()
#         newkeywords.update(fkeywords)
#         return func(*(args + fargs), **newkeywords)
#     newfunc.func = func
#     newfunc.args = args
#     newfunc.keywords = keywords
#     return newfunc
# 
# def url_safe(s):
#     if isinstance(s, STRING):
#         if PY2:
#             s = urllib.quote(s, '')
#         else:
#             s = urllib.parse.quote(s, '')
#     return s
# 
# def utf8(s):
#     if not isinstance(s, str):
#         s = s.encode('utf-8')
#     return s
# 
# def import_httplib():
#     try:
#         import httplib
#     except ImportError:
#         import http.client as httplib
#     return httplib


# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/http.py
import datetime
from .constants import STRING
from .functions import partial, url_safe, utf8, import_httplib



httplib = import_httplib()

class RequestClient(object):
    '''
    A simple http client implement.
    '''
    methods = ['GET', 'POST', 'PUT', 'DELETE', 'HEAD']

    def __init__(self, host, port):
        self.h, self.p = (host, port)
        self.c = httplib.HTTPConnection(self.h, self.p)

    def send_request(self, method, path='', params={}, headers={}, body=''):
        # Start args validate sections.
        assert path and isinstance(path, STRING), 'path must be str and may not be Empty'
        assert not params or isinstance(params, dict), 'params must be dict or None'
        assert not params or isinstance(headers, dict), 'headers must be dict or None'
        if method in ['GET', 'HEAD', 'DELETE']:
            assert not params, 'body is not allowed for method'%(metdod)
        else:

            assert not body or isinstance(body, STRING), 'body must be str or None'