I'm downloading files over HTTPS, I request the files through urllib2.Request
and they come back as a socket._fileobject
. I'd ideally like to stream this to file to avoid loading it into memory but I'm not sure how to do this.
My problem is if I call .read()
on the object it only returns all the data up to the first NUL character and doesn't read the whole file. How can I solve this?
The NUL character comes down as x00
if that's any help, not sure what encoding that is
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…