| 1345 | return url |
| 1346 | |
| 1347 | def __createConnection( |
| 1348 | self, hostname: str | None = None |
| 1349 | ) -> HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass: |
| 1350 | if hostname is None: |
| 1351 | hostname = self.__hostname |
| 1352 | |
| 1353 | if self.__persist and self.__connection is not None and hostname == self.__connection.host: |
| 1354 | return self.__connection |
| 1355 | |
| 1356 | with self.__connection_lock: |
| 1357 | if self.__persist and self.__connection is not None and hostname == self.__connection.host: |
| 1358 | return self.__connection |
| 1359 | if self.__connection is not None: |
| 1360 | self.__connection.close() |
| 1361 | self.__connection = None |
| 1362 | self.__connection = self.__connectionClass( |
| 1363 | hostname, |
| 1364 | self.__port, |
| 1365 | retry=self.__retry, |
| 1366 | pool_size=self.__pool_size, |
| 1367 | timeout=self.__timeout, |
| 1368 | verify=self.__verify, |
| 1369 | ) |
| 1370 | |
| 1371 | return self.__connection |
| 1372 | |
| 1373 | @property |
| 1374 | def _logger(self) -> logging.Logger: |