Skip to content

Commit

Permalink
set proxy if env variable is set (#1494)
Browse files Browse the repository at this point in the history
closes lig-4470
closes #1492

**Changes**
- if `ALL_PROXY`, `HTTPS_PROXY` or `HTTP_PROXY` environment vars are set, pass that information to swagger which triggers the usage `urllib3.ProxyManager`. According to [Olivier Benz](#1492) this should resolve the issue of using lightly behind a corporate mitm proxy.
  • Loading branch information
japrescott authored Feb 5, 2024
1 parent 715844b commit 5b48fea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lightly/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def get_api_client_configuration(
) -> Configuration:
host = get_lightly_server_location_from_env()
ssl_ca_cert = getenv("LIGHTLY_CA_CERTS", None)
proxy = getenv("ALL_PROXY", getenv("HTTPS_PROXY", getenv("HTTP_PROXY", None)))

if token is None:
token = getenv("LIGHTLY_TOKEN", None)
Expand All @@ -239,6 +240,7 @@ def get_api_client_configuration(
configuration = Configuration()
configuration.api_key = {"ApiKeyAuth": token}
configuration.ssl_ca_cert = ssl_ca_cert
configuration.proxy = proxy
configuration.host = host

return configuration

0 comments on commit 5b48fea

Please sign in to comment.