jenkins-bot has submitted this change and it was merged.
Change subject: merge two http.request calls in Request.submit ......................................................................
merge two http.request calls in Request.submit
Request.submit may submit using MIME or URL form. Each approach invoked http.request, and then error handling is performed in a uniform manner.
This patch moves the invocation out of each branch, so changes to the http request parameters can be added in one place rather than twice.
Change-Id: I47cbf80dac5b29f6d9548481815d47140aa0c575 --- M pywikibot/data/api.py 1 file changed, 8 insertions(+), 6 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 0e846ae..bb086fc 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -431,13 +431,15 @@ eoh = body.find(marker) body = body[eoh + len(marker):] # retrieve the headers from the MIME object - mimehead = dict(list(container.items())) - rawdata = http.request(self.site, uri, method="POST", - headers=mimehead, body=body) + headers = dict(list(container.items())) else: - rawdata = http.request(self.site, uri, method="POST", - headers={'Content-Type': 'application/x-www-form-urlencoded'}, - body=paramstring) + headers = {'Content-Type': 'application/x-www-form-urlencoded'} + body = paramstring + + rawdata = http.request( + self.site, uri, method="POST", + headers=headers, body=body) + # import traceback # traceback.print_stack() # print rawdata
pywikibot-commits@lists.wikimedia.org