jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/646601 )
Change subject: [clanup] Remove private functions _http_process and _enqueue ......................................................................
[clanup] Remove private functions _http_process and _enqueue
both functions _http_process and _enqueue aren't used by the framework anymore since Pywikibot 5.0.
Change-Id: I065cc06006bb434f7caa2497ca28d13db1ed97f0 --- M pywikibot/comms/http.py 1 file changed, 0 insertions(+), 99 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index deea88f..552f2ad 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -293,48 +293,6 @@ return None
-@deprecated(since='20201015', future_warning=True) -def _http_process(session, http_request) -> None: # pragma: no cover - """DEPRECATED. - - Process an `threadedhttp.HttpRequest` instance. - - @param session: Session that will be used to process the `http_request`. - @type session: L{requests.Session} - @param http_request: Request that will be processed. - @type http_request: L{threadedhttp.HttpRequest} - """ - method = http_request.method - uri = http_request.uri - params = http_request.params - body = http_request.body - headers = http_request.all_headers - auth = get_authentication(uri) - if auth is not None and len(auth) == 4: - if isinstance(requests_oauthlib, ImportError): - warn('%s' % requests_oauthlib, ImportWarning) - error('OAuth authentication not supported: %s' - % requests_oauthlib) - auth = None - else: - auth = requests_oauthlib.OAuth1(*auth) - 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, params=params, data=body, - headers=headers, auth=auth, timeout=timeout, - verify=not ignore_validation, - **http_request.kwargs) - except Exception as e: - http_request.data = e - else: - http_request.data = response - - def error_handling_callback(request): """ Raise exceptions and log alerts. @@ -364,63 +322,6 @@ warning('Http response status {}'.format(request.status_code))
-@deprecated(since='20201015', future_warning=True) -def _enqueue(uri, method='GET', params=None, body=None, headers=None, - data=None, **kwargs): # pragma: no cover - """DEPRECATED. - - Enqueue non-blocking threaded HTTP request with callback. - - Callbacks, including the default error handler if enabled, are run in the - HTTP thread, where exceptions are logged but are not able to be caught. - The default error handler is called first, then 'callback' (singular), - followed by each callback in 'callbacks' (plural). All callbacks are - invoked, even if the default error handler detects a problem, so they - must check request.exception before using the response data. - - Note: multiple async requests do not automatically run concurrently, - as they are limited by the number of http threads in L{numthreads}, - which is set to 1 by default. - - @see: L{requests.Session.request} for parameters. - - @kwarg default_error_handling: Use default error handling - @type default_error_handling: bool - @kwarg callback: Method to call once data is fetched - @type callback: callable - @kwarg callbacks: Methods to call once data is fetched - @type callbacks: list of callable - @rtype: L{threadedhttp.HttpRequest} - """ - # body and data parameters both map to the data parameter of - # requests.Session.request. - if data: - body = data - - default_error_handling = kwargs.pop('default_error_handling', None) - callback = kwargs.pop('callback', None) - - callbacks = [] - if default_error_handling: - callbacks.append(error_handling_callback) - if callback: - callbacks.append(callback) - - callbacks += kwargs.pop('callbacks', []) - - all_headers = config.extra_headers.copy() - all_headers.update(headers or {}) - - user_agent_format_string = all_headers.get('user-agent') - if not user_agent_format_string or '{' in user_agent_format_string: - all_headers['user-agent'] = user_agent(None, user_agent_format_string) - - request = threadedhttp.HttpRequest( - uri, method, params, body, all_headers, callbacks, **kwargs) - _http_process(session, request) - return request - - @deprecate_arg('callback', True) def fetch(uri, method='GET', params=None, body=None, headers=None, default_error_handling: bool = True,