http – Python requests library HTTPBasicAuth with three parameters

http – Python requests library HTTPBasicAuth with three parameters

HTTPBasicAuth() only ever takes username and password arguments. There is no 3rd argument, full-stop.

HTTP Basic Authentication adds an extra header to the request; this information is kept separate from the GET or POST parameters. When you use this form of authentication, you do not need to pass any username and password parameters to the API methods either.

To add a bookmark, pass in the url parameter as a POST or GET data parameter:

 requests.post(https://www.instapaper.com/api/add, data={url: websiteUrl}, auth=HTTPBasicAuth(username, password))

Either requests.get() or requests.post() will do.

http – Python requests library HTTPBasicAuth with three parameters

Leave a Reply

Your email address will not be published. Required fields are marked *