From 401e17bbdcda31724fa6eda982a5e0473d3c0bf1 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Tue, 28 Dec 2021 18:07:01 -0700 Subject: [PATCH] Update basic auth example --- docs/user/authentication.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/user/authentication.rst b/docs/user/authentication.rst index 4d4040eb..0737bd31 100644 --- a/docs/user/authentication.rst +++ b/docs/user/authentication.rst @@ -19,13 +19,14 @@ the simplest kind, and Requests supports it straight out of the box. Making requests with HTTP Basic Auth is very simple:: >>> from requests.auth import HTTPBasicAuth - >>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass')) + >>> basic = HTTPBasicAuth('user', 'pass') + >>> requests.get('https://httpbin.org/basic-auth/user/pass', auth=basic) In fact, HTTP Basic Auth is so common that Requests provides a handy shorthand for using it:: - >>> requests.get('https://api.github.com/user', auth=('user', 'pass')) + >>> requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass')) Providing the credentials in a tuple like this is exactly the same as the