Spaces:
Runtime error
Runtime error
Commit ·
082aeff
1
Parent(s): 5fae813
Fix cookie set compatibility in load script
Browse files- Remove unsupported secure kwarg for httpx Cookies.set
- Prefer login credentials over stale token env when both are set
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
scripts/load_test_chat.py
CHANGED
|
@@ -59,9 +59,7 @@ async def main() -> None:
|
|
| 59 |
|
| 60 |
async with httpx.AsyncClient(limits=limits, http2=True) as client:
|
| 61 |
host = urlparse(BASE_URL).hostname
|
| 62 |
-
if
|
| 63 |
-
client.cookies.set("access_token", TOKEN, domain=host, secure=BASE_URL.startswith("https://"))
|
| 64 |
-
elif LOGIN_EMAIL and LOGIN_PASSWORD:
|
| 65 |
login = await client.post(
|
| 66 |
f"{BASE_URL}/auth/login",
|
| 67 |
data={"username": LOGIN_EMAIL, "password": LOGIN_PASSWORD},
|
|
@@ -76,8 +74,9 @@ async def main() -> None:
|
|
| 76 |
"access_token",
|
| 77 |
access_token,
|
| 78 |
domain=host,
|
| 79 |
-
secure=BASE_URL.startswith("https://"),
|
| 80 |
)
|
|
|
|
|
|
|
| 81 |
else:
|
| 82 |
raise RuntimeError(
|
| 83 |
"Set LOADTEST_ACCESS_TOKEN (or LOADTEST_BEARER_TOKEN) OR "
|
|
|
|
| 59 |
|
| 60 |
async with httpx.AsyncClient(limits=limits, http2=True) as client:
|
| 61 |
host = urlparse(BASE_URL).hostname
|
| 62 |
+
if LOGIN_EMAIL and LOGIN_PASSWORD:
|
|
|
|
|
|
|
| 63 |
login = await client.post(
|
| 64 |
f"{BASE_URL}/auth/login",
|
| 65 |
data={"username": LOGIN_EMAIL, "password": LOGIN_PASSWORD},
|
|
|
|
| 74 |
"access_token",
|
| 75 |
access_token,
|
| 76 |
domain=host,
|
|
|
|
| 77 |
)
|
| 78 |
+
elif TOKEN:
|
| 79 |
+
client.cookies.set("access_token", TOKEN, domain=host)
|
| 80 |
else:
|
| 81 |
raise RuntimeError(
|
| 82 |
"Set LOADTEST_ACCESS_TOKEN (or LOADTEST_BEARER_TOKEN) OR "
|