mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-10 03:23:00 +00:00

* Fixed #1962 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update base-notebook/docker_healthcheck.py Use empty string instead of None Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
27 lines
726 B
Python
Executable File
27 lines
726 B
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import requests
|
|
|
|
# A number of operations below deliberately don't check for possible errors
|
|
# As this is a healthcheck, it should succeed or raise an exception on error
|
|
|
|
runtime_dir = Path("/home/") / os.environ["NB_USER"] / ".local/share/jupyter/runtime/"
|
|
json_file = next(runtime_dir.glob("*server-*.json"))
|
|
|
|
url = json.loads(json_file.read_bytes())["url"]
|
|
url = url + "api"
|
|
|
|
proxies = {
|
|
"http": "",
|
|
"https": "",
|
|
}
|
|
|
|
r = requests.get(url, proxies=proxies, verify=False) # request without SSL verification
|
|
r.raise_for_status()
|
|
print(r.content)
|