databricks-cli
databricks-cli copied to clipboard
Python API does not validate host
If you forget to put https:// in the host here:
api_client = ApiClient(
host = "SOMETHING_WITHOUT_HTTPS://",
token = os.getenv('DATABRICKS_TOKEN')
)
You'll get this exception as self.url is broken:
requests.exceptions.InvalidSchema: No connection adapters were found for '://None/api/2.0/dbfs/get-status'
Thanks for reporting the issue.
The code expects the scheme to be included today but it's reasonable to not require it.
Would you be willing to submit a PR for this?
The code lives here: https://github.com/databricks/databricks-cli/blob/81c26a8c77b377b25663abc201e87163238e3f7d/databricks_cli/sdk/api_client.py#L114-L117