(self)
| 147 | return self.realhost is not None |
| 148 | |
| 149 | def open(self): |
| 150 | if self.scheme == 'http': |
| 151 | self.__http = http_client.HTTPConnection(self.host, self.port, |
| 152 | timeout=self.__connect_timeout_s) |
| 153 | elif self.scheme == 'https': |
| 154 | self.__http = http_client.HTTPSConnection(self.host, self.port, |
| 155 | timeout=self.__connect_timeout_s, |
| 156 | context=self.context) |
| 157 | if self.using_proxy(): |
| 158 | self.__http.set_tunnel(self.realhost, self.realport, |
| 159 | {"Proxy-Authorization": self.proxy_auth}) |
| 160 | # Initiate connection with configured timeout. |
| 161 | self.__http.connect() |
| 162 | # Set socket_timeout_s for the remainder of the session. |
| 163 | self.__http.sock.settimeout(self.__socket_timeout_s) |
| 164 | |
| 165 | def close(self): |
| 166 | self.__http.close() |
no test coverage detected