Skip to content
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
9 changes: 6 additions & 3 deletions assemblyai/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import BinaryIO, List, Optional
from urllib.parse import urlencode

import httpx

Expand Down Expand Up @@ -142,9 +143,11 @@ def word_search(
) -> types.WordSearchMatchResponse:
response = client.get(
f"/transcript/{transcript_id}/word-search",
params={
"words": words,
},
params=urlencode(
{
"words": ",".join(words),
}
),
)

if response.status_code != httpx.codes.ok:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="assemblyai",
version="0.5.0",
version="0.5.1",
description="AssemblyAI Python SDK",
author="AssemblyAI",
author_email="engineering.sdk@assemblyai.com",
Expand Down
8 changes: 6 additions & 2 deletions tests/unit/test_transcript.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Dict, List
from urllib.parse import urlencode

import httpx
import pytest
Expand Down Expand Up @@ -114,9 +115,12 @@ def test_word_search_succeeds(httpx_mock: HTTPXMock):
factories.WordSearchMatchResponseFactory
)()

search_words = {
"words": ",".join(["test", "me"]),
}
# mock the specific endpoints
url = httpx.URL(
f"{aai.settings.base_url}/transcript/{transcript.id}/word-search?words=test",
f"{aai.settings.base_url}/transcript/{transcript.id}/word-search?{urlencode(search_words)}",
)

httpx_mock.add_response(
Expand All @@ -127,7 +131,7 @@ def test_word_search_succeeds(httpx_mock: HTTPXMock):
)

# mimic the SDK call
matches = transcript.word_search(words=["test"])
matches = transcript.word_search(words=["test", "me"])

# check integrity of the response

Expand Down