File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from typing import Any
33from urllib .parse import urlsplit , urlunparse
44
5- INVALID_ENV_URL_MESSAGE = "Invalid base URL. Expected scheme://host[:port]"
5+ INVALID_ENV_URL_MESSAGE = (
6+ "Base URL is required. "
7+ "Set it up as env variable MPT_URL or pass it as `base_url` "
8+ "argument to MPTClient. Expected format scheme://host[:port]"
9+ )
610PATH_TO_REMOVE_RE = re .compile (r"^/$|^/public/?$|^/public/v1/?$" )
711
812
913def validate_base_url (base_url : Any ) -> str :
1014 """Validate base url."""
1115 if not base_url or not isinstance (base_url , str ):
12- raise ValueError (
13- "Base URL is required. "
14- "Set it up as env variable MPT_URL or pass it as `base_url` "
15- "argument to MPTClient."
16- )
16+ raise ValueError (INVALID_ENV_URL_MESSAGE )
1717 split_result = urlsplit (base_url , scheme = "https" )
1818 if split_result .scheme and split_result .hostname :
1919 host = (
You can’t perform that action at this time.
0 commit comments