refac
This commit is contained in:
@@ -228,22 +228,23 @@ async def upload_pipeline(
|
||||
headers = {"Authorization": f"Bearer {key}"}
|
||||
|
||||
async with aiohttp.ClientSession(trust_env=True) as session:
|
||||
form_data = aiohttp.FormData()
|
||||
form_data.add_field(
|
||||
"file",
|
||||
open(file_path, "rb"),
|
||||
filename=filename,
|
||||
content_type="application/octet-stream",
|
||||
)
|
||||
with open(file_path, "rb") as f:
|
||||
form_data = aiohttp.FormData()
|
||||
form_data.add_field(
|
||||
"file",
|
||||
f,
|
||||
filename=filename,
|
||||
content_type="application/octet-stream",
|
||||
)
|
||||
|
||||
async with session.post(
|
||||
f"{url}/pipelines/upload",
|
||||
headers=headers,
|
||||
data=form_data,
|
||||
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||
) as response:
|
||||
response.raise_for_status()
|
||||
data = await response.json()
|
||||
async with session.post(
|
||||
f"{url}/pipelines/upload",
|
||||
headers=headers,
|
||||
data=form_data,
|
||||
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||
) as response:
|
||||
response.raise_for_status()
|
||||
data = await response.json()
|
||||
|
||||
return {**data}
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user