OCA / odoorpc

Python module to pilot your Odoo servers through JSON-RPC.
http://pythonhosted.org/OdooRPC/
GNU Lesser General Public License v3.0
231 stars 123 forks source link

basic implementation of handling HTTP basic-auth #92

Open LUNEXTLABS-Tobi opened 10 months ago

LUNEXTLABS-Tobi commented 10 months ago

This implements a very basic handling of HTTP basic authentication

For this to work, the proxy will add a HTTPBasicAuthHandler with a HTTPPasswordMgrWithDefaultRealm to its opener. Whenever a server returns a 401 "Unauthorized", now urllib2 will automatically present supplied HTTP basic auth credentials.

The only thing users have to change in their code, in order to use basic authentication, is adding a parameter basic_auth=(url, user, pw) to their instantiation of odoorpc.

LUNEXTLABS-Tobi commented 10 months ago

Looks like odoorpc already supports handling basic-auth by adjusting custom opener. If this holds true, please simply reject this PR.