| 386 | self._event_emitter = event_emitter |
| 387 | |
| 388 | def create_endpoint( |
| 389 | self, |
| 390 | service_model, |
| 391 | region_name, |
| 392 | endpoint_url, |
| 393 | verify=None, |
| 394 | response_parser_factory=None, |
| 395 | timeout=DEFAULT_TIMEOUT, |
| 396 | max_pool_connections=MAX_POOL_CONNECTIONS, |
| 397 | http_session_cls=URLLib3Session, |
| 398 | proxies=None, |
| 399 | socket_options=None, |
| 400 | client_cert=None, |
| 401 | proxies_config=None, |
| 402 | ): |
| 403 | if not is_valid_endpoint_url( |
| 404 | endpoint_url |
| 405 | ) and not is_valid_ipv6_endpoint_url(endpoint_url): |
| 406 | raise ValueError(f"Invalid endpoint: {endpoint_url}") |
| 407 | |
| 408 | if proxies is None: |
| 409 | proxies = self._get_proxies(endpoint_url) |
| 410 | endpoint_prefix = service_model.endpoint_prefix |
| 411 | |
| 412 | logger.debug('Setting %s timeout as %s', endpoint_prefix, timeout) |
| 413 | http_session = http_session_cls( |
| 414 | timeout=timeout, |
| 415 | proxies=proxies, |
| 416 | verify=self._get_verify_value(verify), |
| 417 | max_pool_connections=max_pool_connections, |
| 418 | socket_options=socket_options, |
| 419 | client_cert=client_cert, |
| 420 | proxies_config=proxies_config, |
| 421 | ) |
| 422 | |
| 423 | return Endpoint( |
| 424 | endpoint_url, |
| 425 | endpoint_prefix=endpoint_prefix, |
| 426 | event_emitter=self._event_emitter, |
| 427 | response_parser_factory=response_parser_factory, |
| 428 | http_session=http_session, |
| 429 | ) |
| 430 | |
| 431 | def _get_proxies(self, url): |
| 432 | # We could also support getting proxies from a config file, |