From 88afc39f013d41dc5f623f576579d5399a6d8edc Mon Sep 17 00:00:00 2001 From: ByronHsu Date: Mon, 15 May 2023 22:06:40 -0700 Subject: [PATCH] Add http_proxy to client & Fix deviceflow (#1611) * Add http_proxy to client & Fix deviceflow RB=3890720 Signed-off-by: byhsu * nit Signed-off-by: byhsu * lint! Signed-off-by: byhsu --------- Signed-off-by: byhsu Co-authored-by: byhsu Signed-off-by: Eduardo Apolinario --- flytekit/clients/auth/token_client.py | 3 +++ flytekit/configuration/__init__.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flytekit/clients/auth/token_client.py b/flytekit/clients/auth/token_client.py index e5eae32ed7..2b7431cde9 100644 --- a/flytekit/clients/auth/token_client.py +++ b/flytekit/clients/auth/token_client.py @@ -105,6 +105,9 @@ def get_token( proxies = {"https": http_proxy_url, "http": http_proxy_url} if http_proxy_url else None response = requests.post(token_endpoint, data=body, headers=headers, proxies=proxies, verify=verify) + proxies = {"https": http_proxy_url, "http": http_proxy_url} if http_proxy_url else None + response = requests.post(token_endpoint, data=body, headers=headers, proxies=proxies) + if not response.ok: j = response.json() if "error" in j: diff --git a/flytekit/configuration/__init__.py b/flytekit/configuration/__init__.py index 362e6d425d..4108eab231 100644 --- a/flytekit/configuration/__init__.py +++ b/flytekit/configuration/__init__.py @@ -428,7 +428,6 @@ def auto(cls, config_file: typing.Optional[typing.Union[str, ConfigFile]] = None kwargs = set_if_exists(kwargs, "auth_mode", _internal.Credentials.AUTH_MODE.read(config_file)) kwargs = set_if_exists(kwargs, "endpoint", _internal.Platform.URL.read(config_file)) kwargs = set_if_exists(kwargs, "console_endpoint", _internal.Platform.CONSOLE_ENDPOINT.read(config_file)) - kwargs = set_if_exists(kwargs, "http_proxy_url", _internal.Platform.HTTP_PROXY_URL.read(config_file)) return PlatformConfig(**kwargs)