SIGN IN SIGN UP

refactor: use urllib.parse for WebSocket URL construction (#780)

* refactor: use urllib.parse for WebSocket URL construction

Replace manual f-string query parameter concatenation and scheme
swapping with a shared build_ws_url helper that uses urllib.parse
for proper percent-encoding. This fixes free-form values (e.g.
keyterms with spaces) producing malformed URLs.

Affected files:
- realtime/scribe.py — _build_websocket_url
- realtime_tts.py — convert_realtime
- conversational_ai/conversation.py — _get_wss_url and _get_signed_url

Closes #779

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: preserve blank query params in signed URL round-trip

Pass keep_blank_values=True to parse_qsl so empty-valued parameters
(e.g. param=) in the signed URL are not silently dropped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use RFC 3986 percent-encoding to avoid invalidating signed URLs

urlencode defaults to quote_plus which encodes spaces as `+` instead
of `%20`. This can break signed URL signatures when the server
validates against the original encoding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
K
Kræn Hansen committed
837172c5bd426f2e1ee3ea1c3b0b2090c8aa6e6a
Parent: 1f19ff1
Committed by GitHub <noreply@github.com> on 4/29/2026, 11:44:48 AM