Skip to main content
Source Link
Jonathan Works
  • 1.8k
  • 1
  • 17
  • 13

The size of the file is sent as the Content-Length header. Here is how to get it with urllib:

>>> site = urllib.urlopen("http://python.org")
>>> meta = site.info()
>>> print meta.getheaders("Content-Length")
['16535']
>>>

The size of the file is sent as the Content-Length header. Here is how to get it with urllib:

site = urllib.urlopen("http://python.org")
meta = site.info()
print meta.getheaders("Content-Length")

The size of the file is sent as the Content-Length header. Here is how to get it with urllib:

>>> site = urllib.urlopen("http://python.org")
>>> meta = site.info()
>>> print meta.getheaders("Content-Length")
['16535']
>>>
Source Link
Jonathan Works
  • 1.8k
  • 1
  • 17
  • 13

The size of the file is sent as the Content-Length header. Here is how to get it with urllib:

site = urllib.urlopen("http://python.org")
meta = site.info()
print meta.getheaders("Content-Length")