I'm trying to parse the result of a HEAD request done using the Python Requests library, but can't seem to access the response content.
According to the docs, I should be able to access the content from requests.Response.text. This works fine for me on GET requests, but returns None on HEAD requests.
GET request (works)
import requests
response = requests.get(url)
content = response.text
content = <html>...</html>
HEAD request (no content)
import requests
response = requests.head(url)
content = response.text
content = None
EDIT
OK I've quickly realized form the answers that the HEAD request is not supposed to return content- only headers. But does that mean that, to access things found IN the <head>
tag of a page, like <link>
and <meta>
tags, that one must GET the whole document?
<link>
andmeta
tags from a HEAD request- or is that not possible? – Entice