check_hostname requires server_hostname error solution

import requests
r = requests.post(
    "https://api.deepai.org/api/colorizer",
    data={
        'image': 'https://pics0.baidu.com/feed/43a7d933c895d143712f08474bd47c0b5aaf0723.jpeg',
    },
    headers={'api-key': 'quickstart-QUdJIGlzIGNvbWluZy4uLi4K'}
)
print(r.json())

When running the python program today, an error occurred:

ValueError: check_hostname requires server_hostname

The error message is as follows:

After some verification, because the program has a requests request, and I hung up the vpn proxy, the proxy affected the requests request.

Just turn off the local proxy and it's OK.

After turning off the vpn proxy, after testing, the program can run normally.

Guess you like

Origin blog.csdn.net/ramblerviper/article/details/125774482