예제 #1
0
def test_url_with_multiple_slashes():
    assert (config_clean.remove_trailing_slashes("http://example.com/a/b/c") ==
            "http://example.com/a/b/c")
    assert (config_clean.remove_trailing_slashes("http://example.com/a/b/c/")
            == "http://example.com/a/b/c")
    assert (config_clean.remove_trailing_slashes("http://example.com/a/b/c///")
            == "http://example.com/a/b/c")
예제 #2
0
파일: pulsar.py 프로젝트: hsheth2/datahub
    def web_service_url_scheme_host_port(cls, val: str) -> str:
        # Tokenize the web url
        url = urlparse(val)

        if url.scheme not in ["http", "https"]:
            raise ConfigurationError(
                f"Scheme should be http or https, found {url.scheme}"
            )

        if not _is_valid_hostname(url.hostname.__str__()):
            raise ConfigurationError(
                f"Not a valid hostname, hostname contains invalid characters, found {url.hostname}"
            )

        return config_clean.remove_trailing_slashes(val)
예제 #3
0
 def one_of_host_port_or_account_id_is_required(cls, values):
     host_port = values.get("host_port")
     if host_port is not None:
         logger.warning(
             "snowflake's `host_port` option has been deprecated; use account_id instead"
         )
         host_port = remove_protocol(host_port)
         host_port = remove_trailing_slashes(host_port)
         host_port = remove_suffix(host_port, ".snowflakecomputing.com")
         values["host_port"] = host_port
     account_id = values.get("account_id")
     if account_id is None:
         if host_port is None:
             raise ConfigurationError(
                 "One of account_id (recommended) or host_port (deprecated) is required"
             )
         else:
             values["account_id"] = host_port
     return values
예제 #4
0
파일: metabase.py 프로젝트: hsheth2/datahub
 def remove_trailing_slash(cls, v):
     return config_clean.remove_trailing_slashes(v)
예제 #5
0
def test_url_with_suffix():
    assert (config_clean.remove_trailing_slashes("http://example.com/") ==
            "http://example.com")
예제 #6
0
 def host_port_is_valid(cls, v, values, **kwargs):
     v = remove_protocol(v)
     v = remove_trailing_slashes(v)
     v = remove_suffix(v, ".snowflakecomputing.com")
     return v
예제 #7
0
 def host_port_is_valid(cls, v, values, **kwargs):
     v = remove_protocol(v)
     v = remove_trailing_slashes(v)
     v = remove_suffix(v, ".snowflakecomputing.com")
     logger.info(f"Cleaned Host port is {v}")
     return v