slingamn / mureq

Single-file alternative to python-requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for auth parameter

dlopes7 opened this issue · comments

python-requests supports passing an auth object, example:

r = request(method, url, auth=("user", "password"))

It detects basic authentication and builds the Basic {b64encoded} Authentication header for you
It would be nice if mureq also supported this, to more easily replace requests in scripts that make use of auth

Thanks for the suggestion. I'll consider it, but I'm thinking I probably won't do this:

  1. It's fairly easy for clients to build the Authorization header themselves in this case.
  2. mureq cannot support the fully general use case of the auth parameter (an arbitrarily callable that mutates the requests.Request object), since it has no analogue of the requests.Requests class.

Understandable, thanks