Python: Get HTTP headers from urllib2.urlopen call?

前端 未结 6 1101
猫巷女王i
猫巷女王i 2020-11-27 11:22

Does urllib2 fetch the whole page when a urlopen call is made?

I\'d like to just read the HTTP response header without getting the page.

6条回答
  •  眼角桃花
    2020-11-27 11:34

    urllib2.urlopen does an HTTP GET (or POST if you supply a data argument), not an HTTP HEAD (if it did the latter, you couldn't do readlines or other accesses to the page body, of course).

提交回复
热议问题