Python‎ > ‎requests‎ > ‎

requests.head


Definition
Sends a HEAD request.

Syntax
requests.head(url, **kargs)

Parameters
request arguments

Examples
Return with Head request:
 >>> h=requests.head('http://www.pythonlake.com')
>>> h.content
b''
>>> h.text
''
>>> h.cookies
<RequestsCookieJar[]>
>>> h.headers
{'x-robots-tag': 'noarchive', 'expires': 'Tue, 05 May 2015 15:39:11 GMT', 'x-xss-protection': '1; mode=block', 'server': 'GSE', 'etag': '', 'last-modified': 'Tue, 05 May 2015 05:42:00 GMT', 'alternate-protocol': '80:quic,p=1,80:quic,p=1', 'cache-control': 'public, max-age=5', 'content-length': '198956', 'date': 'Tue, 05 May 2015 15:39:06 GMT', 'content-type': 'text/html; charset=utf-8', 'x-content-type-options': 'nosniff'}
>>> h.is_redirect
False
>>> h.links
{}
>>> h.ok
True
>>> h.is_permanent_redirect
False
>>> h.iter_content
<bound method Response.iter_content of <Response [200]>>
>>> h.reason
'OK'
>>> h.request
<PreparedRequest [HEAD]>
>>> h.url
'http://www.pythonlake.com/'
>>> h.status_code
200
>>> 


Comments