Merlijn van Deen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/234017

Change subject: Partially revert "Add OAuth support for Pywikibot"
......................................................................

Partially revert "Add OAuth support for Pywikibot"

This reverts pywikbit/comms/http.py to the state
before commit 8624ddec140253ec46e0f39c1f5bdb05184840ff. Other
changes are left intact.

Bug: T110354
Change-Id: I65a0db01cc277b1220b9e9a4a83b2ebd4b433982
---
M pywikibot/comms/http.py
1 file changed, 4 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/17/234017/1

diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 39d4d4a..ff0c4f3 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -31,11 +31,6 @@
 
 import requests
 
-try:
-    import requests_oauthlib
-except ImportError as e:
-    requests_oauthlib = e
-
 if sys.version_info[0] > 2:
     from http import cookiejar as cookielib
     from urllib.parse import quote
@@ -74,6 +69,8 @@
     pywikibot.debug(u"Loading cookies failed.", _logger)
 else:
     pywikibot.debug(u"Loaded cookies from file.", _logger)
+
+session.cookies = cookie_jar
 
 
 # Prepare flush on quit
@@ -260,7 +257,7 @@
                                      for i in range(len(netloc_parts))]
     for path in netlocs:
         if path in config.authenticate:
-            if len(config.authenticate[path]) in [2, 4]:
+            if len(config.authenticate[path]) == 2:
                 return config.authenticate[path]
             else:
                 warn('Invalid authentication tokens for %s '
@@ -276,25 +273,10 @@
     if PY2 and headers:
         headers = dict((key, str(value)) for key, value in headers.items())
     auth = get_authentication(uri)
-    if auth is not None and len(auth) == 4:
-        if isinstance(requests_oauthlib, ImportError):
-            warn('%s' % requests_oauthlib, ImportWarning)
-            pywikibot.error('OAuth authentication not supported: %s'
-                            % requests_oauthlib)
-            auth = None
-        else:
-            auth = requests_oauthlib.OAuth1(*auth)
-    cookies = cookie_jar
     timeout = config.socket_timeout
     try:
-        ignore_validation = http_request.kwargs.pop(
-            'disable_ssl_certificate_validation', False)
-        # Note that the connections are pooled which mean that a future
-        # HTTPS request can succeed even if the certificate is invalid and
-        # verify=True, when a request with verify=False happened before
         response = session.request(method, uri, data=body, headers=headers,
-                                   cookies=cookies, auth=auth, timeout=timeout,
-                                   verify=not ignore_validation)
+                                   auth=auth, timeout=timeout, verify=True)
     except Exception as e:
         http_request.data = e
     else:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I65a0db01cc277b1220b9e9a4a83b2ebd4b433982
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to