简体   繁体   中英

“getaddr info failed” Error When Attempting POST

I am using urllib and httplib to do an HTTPS POST to a web page, using a PEM cert file and key fileWhen I ran it I got the following error: "I/O error (10109): getaddrinfo failed"

It is obvious I am getting the error trying to do the POST request. How do I eliminate this error?

You've used an incorrect syntax for the hostname and port number. Instead of:

HTTPSConnection("avaa2.example.mil:443", ...)

Try this:

HTTPSConnection("avaa2.example.mil", 443, ...)

Reference: https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM