mirror of
https://github.com/open-webui/open-webui
synced 2025-05-02 20:11:56 +00:00
refac: aiohttp trust_env=True
This commit is contained in:
parent
9bfb4ae838
commit
7d0a78a43a
@ -219,7 +219,8 @@ async def verify_connection(
|
|||||||
key = form_data.key
|
key = form_data.key
|
||||||
|
|
||||||
async with aiohttp.ClientSession(
|
async with aiohttp.ClientSession(
|
||||||
timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST)
|
trust_env=True,
|
||||||
|
timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST),
|
||||||
) as session:
|
) as session:
|
||||||
try:
|
try:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
|
@ -463,7 +463,8 @@ async def get_models(
|
|||||||
|
|
||||||
r = None
|
r = None
|
||||||
async with aiohttp.ClientSession(
|
async with aiohttp.ClientSession(
|
||||||
timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST)
|
trust_env=True,
|
||||||
|
timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST),
|
||||||
) as session:
|
) as session:
|
||||||
try:
|
try:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
@ -544,7 +545,8 @@ async def verify_connection(
|
|||||||
key = form_data.key
|
key = form_data.key
|
||||||
|
|
||||||
async with aiohttp.ClientSession(
|
async with aiohttp.ClientSession(
|
||||||
timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST)
|
trust_env=True,
|
||||||
|
timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST),
|
||||||
) as session:
|
) as session:
|
||||||
try:
|
try:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
|
@ -66,7 +66,7 @@ async def process_pipeline_inlet_filter(request, payload, user, models):
|
|||||||
if "pipeline" in model:
|
if "pipeline" in model:
|
||||||
sorted_filters.append(model)
|
sorted_filters.append(model)
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(trust_env=True) as session:
|
||||||
for filter in sorted_filters:
|
for filter in sorted_filters:
|
||||||
urlIdx = filter.get("urlIdx")
|
urlIdx = filter.get("urlIdx")
|
||||||
if urlIdx is None:
|
if urlIdx is None:
|
||||||
@ -115,7 +115,7 @@ async def process_pipeline_outlet_filter(request, payload, user, models):
|
|||||||
if "pipeline" in model:
|
if "pipeline" in model:
|
||||||
sorted_filters = [model] + sorted_filters
|
sorted_filters = [model] + sorted_filters
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(trust_env=True) as session:
|
||||||
for filter in sorted_filters:
|
for filter in sorted_filters:
|
||||||
urlIdx = filter.get("urlIdx")
|
urlIdx = filter.get("urlIdx")
|
||||||
if urlIdx is None:
|
if urlIdx is None:
|
||||||
|
@ -50,7 +50,7 @@ class JupyterCodeExecuter:
|
|||||||
self.password = password
|
self.password = password
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.kernel_id = ""
|
self.kernel_id = ""
|
||||||
self.session = aiohttp.ClientSession(base_url=self.base_url)
|
self.session = aiohttp.ClientSession(trust_env=True, base_url=self.base_url)
|
||||||
self.params = {}
|
self.params = {}
|
||||||
self.result = ResultModel()
|
self.result = ResultModel()
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ class OAuthManager:
|
|||||||
try:
|
try:
|
||||||
access_token = token.get("access_token")
|
access_token = token.get("access_token")
|
||||||
headers = {"Authorization": f"Bearer {access_token}"}
|
headers = {"Authorization": f"Bearer {access_token}"}
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(trust_env=True) as session:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
"https://api.github.com/user/emails", headers=headers
|
"https://api.github.com/user/emails", headers=headers
|
||||||
) as resp:
|
) as resp:
|
||||||
@ -386,7 +386,7 @@ class OAuthManager:
|
|||||||
get_kwargs["headers"] = {
|
get_kwargs["headers"] = {
|
||||||
"Authorization": f"Bearer {access_token}",
|
"Authorization": f"Bearer {access_token}",
|
||||||
}
|
}
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(trust_env=True) as session:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
picture_url, **get_kwargs
|
picture_url, **get_kwargs
|
||||||
) as resp:
|
) as resp:
|
||||||
|
Loading…
Reference in New Issue
Block a user