jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1325862?usp=email )
Change subject: filepage: Write download chunks directly
......................................................................
filepage: Write download chunks directly
Pass the response iterator directly to the output file.
Avoid a Python-level write loop while preserving chunked streaming.
Change-Id: I6f55a5ef34e1ddd22d77bdd831491718ab4233b3
---
M pywikibot/page/_filepage.py
1 file changed, 2 insertions(+), 3 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 3aba42e..d37fba5 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -427,9 +427,8 @@
req = http.fetch(url, stream=True)
if req.status_code == HTTPStatus.OK:
- with open(path, 'wb') as f:
- for chunk in req.iter_content(chunk_size):
- f.write(chunk)
+ with path.open('wb') as f:
+ f.writelines(req.iter_content(chunk_size))
return thumb or compute_file_hash(path) == revision.sha1
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1325862?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6f55a5ef34e1ddd22d77bdd831491718ab4233b3
Gerrit-Change-Number: 1325862
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]