Connect to the host and port specified in __init__.
(self)
| 430 | self.timeout = timeout |
| 431 | |
| 432 | def connect(self): |
| 433 | """Connect to the host and port specified in __init__.""" |
| 434 | try: |
| 435 | self.sock = socket.create_connection( |
| 436 | (self.host, self.port), |
| 437 | self.timeout, |
| 438 | self.source_address |
| 439 | ) |
| 440 | except (AttributeError, TypeError): |
| 441 | self.sock = create_connection( |
| 442 | (self.host, self.port), |
| 443 | self.timeout, |
| 444 | self.source_address |
| 445 | ) |
| 446 | |
| 447 | if self._tunnel_host: |
| 448 | self._tunnel() |
| 449 | |
| 450 | |
| 451 | if HTTPSConnection: |
no test coverage detected