Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passthrough of transport options #603

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/streaming/action/test_external_actions_requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
from typing import Any, Callable, Dict

import httpx
import pytest
from httpx import Request, Response
from pytest_httpx import HTTPXMock
Expand Down Expand Up @@ -65,6 +66,7 @@ async def test_send_request_responses(
JSON_SCHEMA,
base64.b64encode(os.urandom(32)).decode(),
additional_payload_values={"call_id": "call_id"},
transport=httpx.AsyncHTTPTransport(retries=3, verify=True),
)

assert response.success is expected_success
Expand Down
2 changes: 1 addition & 1 deletion vocode/streaming/action/external_actions_requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async def send_request(
payload: Dict[str, Any],
signature_secret: str,
additional_payload_values: Dict[str, Any] = {},
transport: httpx.AsyncHTTPTransport = httpx.AsyncHTTPTransport(retries=2),
) -> ExternalActionResponse:
encoded_payload = json.dumps({"payload": payload} | additional_payload_values).encode(
"utf-8"
Expand All @@ -63,7 +64,6 @@ async def send_request(
"x-vocode-signature": self._encode_payload(encoded_payload, signature_secret),
}

transport = httpx.AsyncHTTPTransport(retries=2)
async with httpx.AsyncClient(
headers=headers,
transport=transport,
Expand Down
Loading