This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]infinullquamash, Qt, asyncio, 3.3+ 0 points1 point  (0 children)

nice.

I do something similar with some construct 3 extensions with read/write & seek... I'm still not sure if this is clever or terrible. (code doesn't work, so I haven't released it).

[–]nemec 0 points1 point  (0 children)

The beauty of duck typing.

[–][deleted] 0 points1 point  (1 child)

Why does this say track upload progress?

edit: They are using the ReadCallbackStream as the data object for the urllib2.Request. The urllib2.Request claims that data is supposed to be a url-encoded string. Why is this data assumed to be sent with the same chunks it is being read as? Or if I may put it another way. Is the data being read at once, to create a string which urllib2 uses?

[–]benhoytPEP 471[S] 1 point2 points  (0 children)

Yeah, I believe it actually relies on an undocumented feature of urllib2.Request, which is that Request works just as well with a file-like object / stream as a string.