It’s possible your outbound access is being blocked by a firewall - is this a machine on a corporate network? If you have ’telnet’ available, try:
Trying 18.135.122.120...
Escape character is '^]'.
Connection closed by foreign host.
If the connection isn’t allowed, you’ll just see:
Trying 18.135.122.120...
Several seconds later, you may see:
telnet: Unable to connect to remote host
Alternatively, you may see the following come up instantly:
telnet: Unable to connect to remote host
Either of these situations means there’s a device on your host or network blocking access.
What sort of machine are you running on? If it’s Windows, outbound connections from Python may be blocked by Windows Firewall. If you’re using a VPN to connect to a corporate environment (for example), you may be required to use a proxy server to access things on the Internet, so you’ll need to contact your IT team.