How do you send a HEAD HTTP request in Python?

Posted by fuentesjr on Stack Overflow See other posts from Stack Overflow or by fuentesjr
Published on 2008-09-20T06:38:38Z Indexed on 2010/04/13 15:13 UTC
Read the original article Hit count: 405

So what I'm trying to do here is get the headers of a given URL so I can determine the mime-type. I want to be able to see if http://somedomain/foo/ will return an html document or a jpg image for example. Thus, I need to figure out how to send a HEAD request so that I can read the mime-type without having to download the content. Does anyone know of an easy way of doing this?

© Stack Overflow or respective owner

Related posts about python

Related posts about http