title: "getaddrinfo failed" when connecting to SFTP server using Paramiko
body: <p>I am trying to connect to SFTP server but it returns error: </p>
  
  <blockquote>
    <p>[Errno 11001] getaddrinfo failed</p>
  </blockquote>
  
  <p>I am using Python 3.7.3 and Paramiko version is 2.6.0</p>
  
  <pre><code>import paramiko
  
  host_name = "sftp://81.149.151.143"
  user_name = "******"
  password = "******"
  
  ssh_client = paramiko.SSHClient()
  ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh_client.connect(hostname=host_name, port=220, username=user_name, password=password)
  
  ftp_client=ssh_client.open_sftp()
  ftp_client.put('***/issue_1.docx', '/issue_1.docx') 
  ftp_client.close()
  </code></pre>
  
  <p>This is the full error: </p>
  
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
    File "/sftp/paramiko_bot.py", line 10, in &lt;module&gt;
      ssh_client.connect(hostname=host_name, port=22, username=user_name, password=password)
    File "\Local\Programs\Python\Python37\lib\site-packages\paramiko\client.py", line 340, in connect
      to_try = list(self._families_and_addresses(hostname, port))
    File "\Local\Programs\Python\Python37\lib\site-packages\paramiko\client.py", line 204, in _families_and_addresses
      hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM
    File "\AppData\Local\Programs\Python\Python37\lib\socket.py", line 748, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno 11001] getaddrinfo failed
  </code></pre>