The check_hostname
argument is a required parameter when making HTTPS requests using the requests
library in Python. It is used to specify the expected value of the server_hostname
during the TLS/SSL handshake.
If you encounter the ValueError: check_hostname requires server_hostname
error, it means you need to provide a value for the server_hostname
parameter while making the request.
Here's an example of how you can fix this error:
import requests
# Make sure to provide the URL you're trying to access
url = 'https://example.com/'
# Add 'server_hostname' parameter with the correct value
response = requests.get(url, verify=True, server_hostname='example.com')
Replace 'example.com'
with the actual hostname you are trying to access. Make sure to adjust the other parameters of the requests.get()
function as needed for your specific use case.