I'm going to download using GitHub url.
However, the value received by urlopen is not always constant.
If you run the code below,
import urllib.request
url = "https://github.com/PixarAnimationStudios/USD/archive/v20.11.zip"
u = urllib.request.urlopen(url)
meta = u.info()
print(u.headers.keys())
print(u.headers.get("Content-Type"))
print(u.headers.get("Transfer-Encoding"))
print(u.headers.get("Content-Length"))
case1
['Date', 'Content-Type', 'Content-Length', 'Connection', 'Access-Control-Allow-Origin', 'Content-Disposition', 'Content-Security-Policy', 'ETag', 'Strict-Transport-Security', 'Vary', 'X-Content-Type-Options', 'X-Frame-Options', 'X-XSS-Protection', 'X-Varnish', 'Age', 'Via', 'X-Cache', 'X-Cache-Hits', 'Accept-Ranges', 'Vary', 'X-GitHub-Request-Id']
application/zip
None
30301735
case2
['Date', 'Content-Type', 'Transfer-Encoding', 'Connection', 'Access-Control-Allow-Origin', 'Content-Disposition', 'Content-Security-Policy', 'ETag', 'Strict-Transport-Security', 'Vary', 'X-Content-Type-Options', 'X-Frame-Options', 'X-XSS-Protection', 'X-Varnish', 'Age', 'Via', 'X-Cache', 'X-Cache-Hits', 'Accept-Ranges', 'Vary', 'X-GitHub-Request-Id']
application/zip
chunked
None
What is the difference between Content-Length
and Transfer-Encoding
?
i used python3.9