Example #1
0
    def __init__(self, *args, **kw):
        if not six.PY2:
            kw.pop("strict", None)

        # Pre-set source_address.
        self.source_address = kw.get("source_address")

        #: The socket options provided by the user. If no options are
        #: provided, we use the default options.
        self.socket_options = kw.pop("socket_options", self.default_socket_options)

        _HTTPConnection.__init__(self, *args, **kw)
Example #2
0
    def __init__(self, *args, **kw):
        if six.PY3:  # Python 3
            kw.pop('strict', None)

        # Pre-set source_address.
        self.source_address = kw.get('source_address')

        #: The socket options provided by the user. If no options are
        #: provided, we use the default options.
        self.socket_options = kw.pop('socket_options', self.default_socket_options)

        _HTTPConnection.__init__(self, *args, **kw)
 def __init__(self, host, port=None, key_file=None, cert_file=None,
                          ca_certs=None, strict=None, **kwargs):
     if six.PY2:
         HTTPConnection.__init__(self, host=host, port=port, strict=strict, **kwargs)
     else:
         # python3's HTTPConnection dropped the strict argument.
         HTTPConnection.__init__(self, host=host, port=port, **kwargs)
     self.key_file = key_file
     self.cert_file = cert_file
     self.ca_certs = ca_certs
     if self.ca_certs:
         self.cert_reqs = ssl.CERT_REQUIRED
     else:
         self.cert_reqs = ssl.CERT_NONE
Example #4
0
    def __init__(self, *args, **kw):
        if six.PY3:  # Python 3
            kw.pop('strict', None)

        # Pre-set source_address in case we have an older Python like 2.6.
        self.source_address = kw.get('source_address')

        if sys.version_info < (2, 7):  # Python 2.6
            # _HTTPConnection on Python 2.6 will balk at this keyword arg, but
            # not newer versions. We can still use it when creating a
            # connection though, so we pop it *after* we have saved it as
            # self.source_address.
            kw.pop('source_address', None)

        #: The socket options provided by the user. If no options are
        #: provided, we use the default options.
        self.socket_options = kw.pop('socket_options',
                                     self.default_socket_options)

        # Superclass also sets self.source_address in Python 2.7+.
        _HTTPConnection.__init__(self, *args, **kw)
Example #5
0
 def __init__(self, *args, **kwargs):
     HTTPConnection.__init__(self, *args, **kwargs)
     self._canceled = False
     self.deadline = 0
 def __init__(self, path):
     HTTPConnection.__init__(self, 'localhost')
     self.path = path
Example #7
0
 def __init__(self, host, *fakedata):
     HTTPConnection.__init__(self, host)
     self.fakedata = list(fakedata)