# Path: suds/transport/http.py
# class HttpTransport(Transport):
#     """
#     HTTP transport using urllib2.  Provided basic http transport
#     that provides for cookies, proxies but no authentication.
#     """
# 
#     def __init__(self, **kwargs):
#         """
#         @param kwargs: Keyword arguments.
#             - B{proxy} - An http proxy to be specified on requests.
#                  The proxy is defined as {protocol:proxy,}
#                     - type: I{dict}
#                     - default: {}
#             - B{timeout} - Set the url open timeout (seconds).
#                     - type: I{float}
#                     - default: 90
#         """
#         Transport.__init__(self)
#         Unskin(self.options).update(kwargs)
#         self.cookiejar = CookieJar()
#         self.proxy = {}
#         self.urlopener = None
# 
#     def open(self, request):
#         try:
#             url = request.url
#             headers = request.headers
#             log.debug('opening (%s)', url)
#             u2request = u2.Request(url, None, headers)
#             self.proxy = self.options.proxy
#             return self.u2open(u2request)
#         except HTTPError as e:
#             raise TransportError(str(e), e.code, e.fp)
# 
#     def send(self, request):
#         result = None
#         url = request.url
#         msg = request.message
#         headers = request.headers
#         try:
#             u2request = u2.Request(url, msg, headers)
#             self.addcookies(u2request)
#             self.proxy = self.options.proxy
#             request.headers.update(u2request.headers)
#             log.debug('sending:\n%s', request)
#             fp = self.u2open(u2request)
#             self.getcookies(fp, u2request)
#             result = Reply(200, fp.headers, fp.read())
#             log.debug('received:\n%s', result)
#         except HTTPError as e:
#             if e.code in (202, 204):
#                 result = None
#             else:
#                 raise TransportError(e.msg, e.code, e.fp)
#         return result
# 
#     def addcookies(self, u2request):
#         """
#         Add cookies in the cookiejar to the request.
#         @param u2request: A urllib2 request.
#         @rtype: u2request: urllib2.Requet.
#         """
#         self.cookiejar.add_cookie_header(u2request)
# 
#     def getcookies(self, fp, u2request):
#         """
#         Add cookies in the request to the cookiejar.
#         @param u2request: A urllib2 request.
#         @rtype: u2request: urllib2.Requet.
#         """
#         self.cookiejar.extract_cookies(fp, u2request)
# 
#     def u2open(self, u2request):
#         """
#         Open a connection.
#         @param u2request: A urllib2 request.
#         @type u2request: urllib2.Requet.
#         @return: The opened file-like urllib2 object.
#         @rtype: fp
#         """
#         tm = self.options.timeout
#         url = self.u2opener()
#         if self.u2ver() < 2.6:
#             socket.setdefaulttimeout(tm)
#             return url.open(u2request)
#         else:
#             return url.open(u2request, timeout=tm)
# 
#     def u2opener(self):
#         """
#         Create a urllib opener.
#         @return: An opener.
#         @rtype: I{OpenerDirector}
#         """
#         if self.urlopener is None:
#             return u2.build_opener(*self.u2handlers())
#         else:
#             return self.urlopener
# 
#     def u2handlers(self):
#         """
#         Get a collection of urllib handlers.
#         @return: A list of handlers to be installed in the opener.
#         @rtype: [Handler,...]
#         """
#         handlers = []
#         handlers.append(u2.ProxyHandler(self.proxy))
#         return handlers
# 
#     def u2ver(self):
#         """
#         Get the major/minor version of the urllib2 lib.
#         @return: The urllib2 version.
#         @rtype: float
#         """
#         try:
#             part = u2.__version__.split('.', 1)
#             n = float('.'.join(part))
#             return n
#         except Exception as e:
#             log.exception(e)
#             return 0
# 
#     def __deepcopy__(self, memo={}):
#         clone = self.__class__()
#         p = Unskin(self.options)
#         cp = Unskin(clone.options)
#         cp.update(p)
#         return clone


from suds.transport.http import HttpTransport
from logging import getLogger
from urllib.request import (
    HTTPPasswordMgrWithDefaultRealm,
    HTTPBasicAuthHandler)
            from ntlm3 import HTTPNtlmAuthHandler

log = getLogger(__name__)


class HttpAuthenticated(HttpTransport):
    """
    Provides basic http authentication that follows the RFC-2617 specification.
    As defined by specifications, credentials are provided to the server
    upon request (HTTP/1.0 401 Authorization Required) by the server only.
    @ivar pm: The password manager.
    @ivar handler: The authentication handler.
    """

    def __init__(self, **kwargs):
        """
        @param kwargs: Keyword arguments.
            - B{proxy} - An http proxy to be specified on requests.
                 The proxy is defined as {protocol:proxy,}
                    - type: I{dict}
                    - default: {}
            - B{timeout} - Set the url open timeout (seconds).
                    - type: I{float}
                    - default: 90
            - B{username} - The username used for http authentication.
                    - type: I{str}
                    - default: None
            - B{password} - The password used for http authentication.
                    - type: I{str}
                    - default: None
        """

# Path: suds/transport/http.py
# class HttpTransport(Transport):
#     """
#     HTTP transport using urllib2.  Provided basic http transport
#     that provides for cookies, proxies but no authentication.
#     """
# 
#     def __init__(self, **kwargs):
#         """
#         @param kwargs: Keyword arguments.
#             - B{proxy} - An http proxy to be specified on requests.
#                  The proxy is defined as {protocol:proxy,}
#                     - type: I{dict}
#                     - default: {}
#             - B{timeout} - Set the url open timeout (seconds).
#                     - type: I{float}
#                     - default: 90
#         """
#         Transport.__init__(self)
#         Unskin(self.options).update(kwargs)
#         self.cookiejar = CookieJar()
#         self.proxy = {}
#         self.urlopener = None
# 
#     def open(self, request):
#         try:
#             url = request.url
#             headers = request.headers
#             log.debug('opening (%s)', url)
#             u2request = u2.Request(url, None, headers)
#             self.proxy = self.options.proxy
#             return self.u2open(u2request)
#         except HTTPError as e:
#             raise TransportError(str(e), e.code, e.fp)
# 
#     def send(self, request):
#         result = None
#         url = request.url
#         msg = request.message
#         headers = request.headers
#         try:
#             u2request = u2.Request(url, msg, headers)
#             self.addcookies(u2request)
#             self.proxy = self.options.proxy
#             request.headers.update(u2request.headers)
#             log.debug('sending:\n%s', request)
#             fp = self.u2open(u2request)
#             self.getcookies(fp, u2request)
#             result = Reply(200, fp.headers, fp.read())
#             log.debug('received:\n%s', result)
#         except HTTPError as e:
#             if e.code in (202, 204):
#                 result = None
#             else:
#                 raise TransportError(e.msg, e.code, e.fp)
#         return result
# 
#     def addcookies(self, u2request):
#         """
#         Add cookies in the cookiejar to the request.
#         @param u2request: A urllib2 request.
#         @rtype: u2request: urllib2.Requet.
#         """
#         self.cookiejar.add_cookie_header(u2request)
# 
#     def getcookies(self, fp, u2request):
#         """
#         Add cookies in the request to the cookiejar.
#         @param u2request: A urllib2 request.
#         @rtype: u2request: urllib2.Requet.
#         """
#         self.cookiejar.extract_cookies(fp, u2request)
# 
#     def u2open(self, u2request):
#         """
#         Open a connection.
#         @param u2request: A urllib2 request.
#         @type u2request: urllib2.Requet.
#         @return: The opened file-like urllib2 object.
#         @rtype: fp
#         """
#         tm = self.options.timeout
#         url = self.u2opener()
#         if self.u2ver() < 2.6:
#             socket.setdefaulttimeout(tm)
#             return url.open(u2request)
#         else:
#             return url.open(u2request, timeout=tm)
# 
#     def u2opener(self):
#         """
#         Create a urllib opener.
#         @return: An opener.
#         @rtype: I{OpenerDirector}
#         """
#         if self.urlopener is None:
#             return u2.build_opener(*self.u2handlers())
#         else:
#             return self.urlopener
# 
#     def u2handlers(self):
#         """
#         Get a collection of urllib handlers.
#         @return: A list of handlers to be installed in the opener.
#         @rtype: [Handler,...]
#         """
#         handlers = []
#         handlers.append(u2.ProxyHandler(self.proxy))
#         return handlers
# 
#     def u2ver(self):
#         """
#         Get the major/minor version of the urllib2 lib.
#         @return: The urllib2 version.
#         @rtype: float
#         """
#         try:
#             part = u2.__version__.split('.', 1)
#             n = float('.'.join(part))
#             return n
#         except Exception as e:
#             log.exception(e)
#             return 0
# 
#     def __deepcopy__(self, memo={}):
#         clone = self.__class__()
#         p = Unskin(self.options)
#         cp = Unskin(clone.options)
#         cp.update(p)
#         return clone


# Path: suds/transport/https.py
from suds.transport.http import HttpTransport
from logging import getLogger
from urllib.request import (
    HTTPPasswordMgrWithDefaultRealm,
    HTTPBasicAuthHandler)
            from ntlm3 import HTTPNtlmAuthHandler


log = getLogger(__name__)


class HttpAuthenticated(HttpTransport):
    """
    Provides basic http authentication that follows the RFC-2617 specification.
    As defined by specifications, credentials are provided to the server
    upon request (HTTP/1.0 401 Authorization Required) by the server only.
    @ivar pm: The password manager.
    @ivar handler: The authentication handler.
    """

    def __init__(self, **kwargs):
        """
        @param kwargs: Keyword arguments.
            - B{proxy} - An http proxy to be specified on requests.
                 The proxy is defined as {protocol:proxy,}
                    - type: I{dict}
                    - default: {}
            - B{timeout} - Set the url open timeout (seconds).
                    - type: I{float}
                    - default: 90
            - B{username} - The username used for http authentication.
                    - type: I{str}
                    - default: None
            - B{password} - The password used for http authentication.
                    - type: I{str}
                    - default: None
        """

        HttpTransport.__init__(self, **kwargs)