I was playing around with urllib.request module when I found that calling read() method on a urllib.request.urlopen() object results in no response the second time:
code:
import urllib.request
url = 'http://www.youtube.com'
resp = urllib.request.urlopen(url)
print(len(resp.read()))  # first call
print(len(resp.read()))  # second call
output:
549444
0
I can't find any documentation regarding read() method, I want to better understand what exactly is happening in the above code. An obvious fix might be to call the urlopen() method again but this would be inefficient.
