Discussion:
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: comms.http: Include HttpRequest.kwargs in session.request call
Rafidaslam (Code Review)
2017-12-31 05:03:10 UTC
Permalink
Rafidaslam has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401116 )

Change subject: comms.http: Include HttpRequest.kwargs in session.request call
......................................................................

comms.http: Include HttpRequest.kwargs in session.request call

Include threadedhttp.HttpRequest.kwargs in session.request call in
`_http_process()`.

Before this HttpRequest.kwargs didn't get into session.request call
so if we call a function like `pywikibot.comms.http.fetch()` with
parameter like `stream=True`, the `stream` param would be ignored.

Bug: T183830
Change-Id: I02d71a933bc1ef0073a0ec34534b4eeeefc10e91
---
M pywikibot/comms/http.py
1 file changed, 2 insertions(+), 1 deletion(-)


git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/16/401116/1

diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index b6fb20d..6855195 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -374,7 +374,8 @@
# 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)
+ verify=not ignore_validation,
+ **http_request.kwargs)
except Exception as e:
http_request.data = e
else:
--
To view, visit https://gerrit.wikimedia.org/r/401116
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02d71a933bc1ef0073a0ec34534b4eeeefc10e91
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Rafidaslam <***@gmail.com>
jenkins-bot (Code Review)
2017-12-31 10:28:16 UTC
Permalink
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/401116 )

Change subject: comms.http: Include HttpRequest.kwargs in session.request call
......................................................................


comms.http: Include HttpRequest.kwargs in session.request call

Include threadedhttp.HttpRequest.kwargs in session.request call in
`_http_process()`.

Before this HttpRequest.kwargs didn't get into session.request call
so if we call a function like `pywikibot.comms.http.fetch()` with
parameter like `stream=True`, the `stream` param would be ignored.

Bug: T183830
Change-Id: I02d71a933bc1ef0073a0ec34534b4eeeefc10e91
---
M pywikibot/comms/http.py
1 file changed, 12 insertions(+), 1 deletion(-)

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



diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index b6fb20d..ba569f6 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -349,6 +349,16 @@


def _http_process(session, http_request):
+ """
+ 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}
+ @return: None
+ @rtype: None
+ """
method = http_request.method
uri = http_request.uri
params = http_request.params
@@ -374,7 +384,8 @@
# 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)
+ verify=not ignore_validation,
+ **http_request.kwargs)
except Exception as e:
http_request.data = e
else:
--
To view, visit https://gerrit.wikimedia.org/r/401116
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I02d71a933bc1ef0073a0ec34534b4eeeefc10e91
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Rafidaslam <***@gmail.com>
Gerrit-Reviewer: John Vandenberg <***@gmail.com>
Gerrit-Reviewer: Rafidaslam <***@gmail.com>
Gerrit-Reviewer: Xqt <***@gno.de>
Gerrit-Reviewer: Zoranzoki21 <***@gmail.com>
Gerrit-Reviewer: jenkins-bot <>
Loading...