Return a bare hostname from ``params.server`` / config ``server`` when the value is a full URL (https://qa.keepersecurity.com). Otherwise return the string unchanged. Used for krelay / ICE hostnames where a scheme must not be present.
(server)
| 433 | |
| 434 | |
| 435 | def get_keeper_server_hostname(server): |
| 436 | """ |
| 437 | Return a bare hostname from ``params.server`` / config ``server`` when the value |
| 438 | is a full URL (https://qa.keepersecurity.com). Otherwise return the string unchanged. |
| 439 | Used for krelay / ICE hostnames where a scheme must not be present. |
| 440 | """ |
| 441 | if not server: |
| 442 | return server |
| 443 | if server.startswith("http://") or server.startswith("https://"): |
| 444 | parsed_host = urlparse(server).hostname |
| 445 | if parsed_host: |
| 446 | return parsed_host |
| 447 | return server |
| 448 | |
| 449 | def get_keeper_host_for_services(server_hostname): |
| 450 | """ |
no outgoing calls
no test coverage detected