Explicitly use proxy
This commit is contained in:
parent
390488558e
commit
94e12af103
1 changed files with 5 additions and 1 deletions
|
@ -52,6 +52,9 @@ app = fastapi.FastAPI(
|
||||||
root_path=os.environ.get("PREVIEW_ROOT_PATH", ""),
|
root_path=os.environ.get("PREVIEW_ROOT_PATH", ""),
|
||||||
lifespan=startup
|
lifespan=startup
|
||||||
)
|
)
|
||||||
|
proxy = os.getenv("PREVIEW_PROXY")
|
||||||
|
if proxy:
|
||||||
|
logging.debug("Using proxy: %r", proxy)
|
||||||
lock = Lock()
|
lock = Lock()
|
||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
|
@ -259,7 +262,8 @@ def preview_url(
|
||||||
},
|
},
|
||||||
timeout=60,
|
timeout=60,
|
||||||
follow_redirects=False,
|
follow_redirects=False,
|
||||||
trust_env=True # for HTTP[S]/ALL_PROXY environment variables.
|
trust_env=True, # for HTTP[S]/ALL_PROXY environment variables.
|
||||||
|
proxy=proxy
|
||||||
) as client:
|
) as client:
|
||||||
try:
|
try:
|
||||||
response = client.get(
|
response = client.get(
|
||||||
|
|
Loading…
Reference in a new issue