Replies: 1 comment
-
|
After some experimentation & debugging, I've found that it's possible to send bytes parameters through httpx if you do all of the URL-encoding and -construction manually, e.g.: from urllib.parse import quote
import httpx
BASE_URL = "..."
INFO_HASH = b"..."
url = f"{BASE_URL}?info_hash={quote(INFO_HASH)}"
async with httpx.AsyncClient() as client:
r = await client.get(url)Note that, if you try to also pass in a separate I'd still prefer it if httpx had built-in support for this, though. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Certain HTTP applications (like BitTorrent) require clients to send GET requests in which one or more query parameters are URL-encoded byte sequences, e.g.,
?info_hash=%124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A. Is there any way to send such requests with httpx? Trying to pass abytesinstance as a value inparamsresults in the URL-encoding of the bytes'reprbeing used, and if thebytesis decoded with Latin-1, httpx will just re-encode it as UTF-8 before URL-encoding, which is wrong.I am aware of issue #746, which currently says there are no plans to support
bytesvalues inparams, but I felt it was still worth asking if there was another way to accomplish what I need with this library.Beta Was this translation helpful? Give feedback.
All reactions