get image image memeory size in url inpyton requests 1

get image image memeory size in url inpyton requests

import urllib.request, io
url = 'http://www.elsecarrailway.co.uk/images/Events/TeddyBear-3.jpg'
path = urllib.request.urlopen(url)
meta = path.info()

>>>meta.get(name="Content-Length")
'269898' # ie  269kb

Here is what the above code is Doing:
1. We’re using the urllib.request module to open the URL.
2. We’re using the info() method to get the metadata.
3. We’re using the get() method to get the value of the Content-Length key.

Similar Posts