Ryan10145 added a comment.

I downloaded the patch that fixed the issue, but I am still running into issues with the streaming. First of all, when I test the functionality of pywikibot.comms.http.fetch(url, stream=True) from the pywikibot shell, it works as intended. I tested it using

def test_fetch():
    resp = pywikibot.comms.http.fetch('https://dumps.wikimedia.org/idwiki/latest/idwiki-latest-abstract.xml', stream=True)
    for data in resp.data.iter_content(100 * 1024):
         sys.stdout.write('asd')
         sys.stdout.flush()

This produced the string 'asd' gradually as it began downloading the file.
However, when I go into download_dump.py, and I have the below code, it does not work.

response = fetch(url, stream=True)
for data in response.data.iter_content(100 * 1024):
    sys.stdout.write('asd')
    sys.stdout.flush()

What happens instead is that there is a ~10 second pause, and then the string 'asd' is printed many times, nearly instantaneously.
I don't know why this is occurring, and help would be greatly appreciated.


TASK DETAIL
https://phabricator.wikimedia.org/T183664

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Ryan10145
Cc: rafidaslam, pywikibot-bugs-list, eflyjason, Aklapper, Xqt, zhuyifei1999, jayvdb, siebrand, Zoranzoki21, Framawiki, Bright1055, Toppole69, Mine0901, Jayprakash12345, Magul, Tbscho, MayS, Beeyan, Mdupont, JJMC89, MtDu, D3r1ck01, Avicennasis, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to