jenkins-bot has submitted this change and it was merged.

Change subject: Reimplement Http basic authentication
......................................................................


Reimplement Http basic authentication

Bug: T101494
Change-Id: I784bb1f8c893d02df6dfad5ae80942f6b1f944c9
---
M pywikibot/comms/http.py
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index a6ed6a8..6c35fe3 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -252,14 +252,15 @@
     uri = http_request.uri
     body = http_request.body
     headers = http_request.headers
+    auth = config.authenticate.get(requests.utils.urlparse(uri).netloc, None)
     timeout = config.socket_timeout
     try:
-        request = session.request(method, uri, data=body, headers=headers,
-                                  verify=True, timeout=timeout)
+        response = session.request(method, uri, data=body, headers=headers,
+                                   auth=auth, timeout=timeout, verify=True)
     except Exception as e:
         http_request.data = e
     else:
-        http_request.data = request
+        http_request.data = response
 
 
 def error_handling_callback(request):

-- 
To view, visit https://gerrit.wikimedia.org/r/220131
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I784bb1f8c893d02df6dfad5ae80942f6b1f944c9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: VcamX <vca...@gmail.com>
Gerrit-Reviewer: Dragan Espenschied <dragan.espensch...@rhizome.org>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl>
Gerrit-Reviewer: Mjbmr <mjb...@gmail.com>
Gerrit-Reviewer: XZise <commodorefabia...@gmx.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
Pywikibot-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to