Closed heysarthak closed 2 months ago
%
character has a special meaning in URLs, representing the start of a percent-encoded character. To include a literal %
character in a URL, it must be percent-encoded as %25
.
You can manually encode the query parameters in Python using the urllib.parse
module:
from urllib.parse import quote
import httpx
query_param = "ngi%abc.com"
encoded_query_param = quote(query_param)
url = f"https://example.com/search?q={encoded_query_param}"
resp = httpx.get(url)
Discussed in https://github.com/encode/httpx/discussions/3094