Overview:
- The head() method sends a http HEAD request to a resolved web server of a given domain name.
- The head() method returns a response object containing the reply for the HEAD request.
- If the response object is printed directly, the string representation of the object is printed in the format <Response [Status code]> e.g., <Response [200]>.
- If a specific field from the response to the HEAD request is required, it can be obtained through the headers attribute of the request object.
- Alternatively, the method request() can be invoked with a request type string as “HEAD”.
Example:
| # Example Python program that sends a HTTP HEAD request # Send a request to a HTTP port # Send a request to a HTTPS port # The dictionary is a CaseInsensitiveDict | 
Output:
| <Response [200]> |