Skip to content

Commit 47ce295

Browse files
authored
set openai.proxy explicitly to Requests lib to override environmental defaults (openai#339)
By default, the Requests library use the proxy settings from the environment variable HTTPS_PROXY. It has higher priority than the "proxies" setting in the session, which may lead to confusing behaviors if both environment variables and the "openai.proxy" config are set. This patch explicitly informs the Requests library to use the "openai.proxy" config.
1 parent 15c6aeb commit 47ce295

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

openai/api_requestor.py

+1
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ def request_raw(
521521
files=files,
522522
stream=stream,
523523
timeout=request_timeout if request_timeout else TIMEOUT_SECS,
524+
proxies=_thread_context.session.proxies,
524525
)
525526
except requests.exceptions.Timeout as e:
526527
raise error.Timeout("Request timed out: {}".format(e)) from e

0 commit comments

Comments
 (0)