I can't find a way to send user credentials with aiohttp. I want similar behavior to cURL's
curl --user "USER:PASSWORD"
but in aiohttp. On the reference doc I can't find this option, I can find query parameters, headers, body, but not user credentials.
I'm using aiohttp instead of curl for its asynchronous behavior.
It is the same as using basic authentication.
So to use it in aiohttp
, you could use aiohttp.BasicAuth
. Somehow like:
async with client.get(url, auth=aiohttp.BasicAuth(user, password)) as resp:
assert resp.status == 200
print(await resp.text())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With