in tools/build-image.py [0:0]
def get_token():
cmd = get_cmd("curl")
curl = [cmd, "-X", "POST", "-H", "Content-Type: application/json"]
curl.extend(["-d", '{"username": "' + docker_user + '", "password": "' + docker_pass + '"}'])
curl.extend(["https://hub.docker.com/v2/users/login/"])
p = subprocess.run(curl, capture_output=True)
try:
data = json.loads(p.stdout)
except json.JSONDecodeError:
fail("login failed: unexpected json decode failure: %s" %p.stdout)
if "detail" in data:
fail("authentication failed: %s" % data["detail"])
if "token" not in data:
fail("login failed: unexpected json content: %s" % data)
global docker_token
docker_token = data["token"]