title: Python Connect over HTTP proxy with pysftp
body: <p>Currently, I am doing SFTP transfer using Python <code>subprocess.POPEN</code> and PuTTY <code>psftp.exe</code>.</p>
  
  <p>It is working, but not really clean nor transportable. </p>
  
  <p>I would like to reproduce the same behavior using Python pysftp, but I do not know where to input all the parameters. I have in PuTTY the following configuration:</p>
  
  <ul>
  <li>Server IP : 123.123.123.255</li>
  <li>Server Port : 22</li>
  <li>Connection Type : SSH</li>
  <li>AutoLogin UserName : MyUser</li>
  <li>Proxy type : HTTP</li>
  <li>Proxy Hostname : gw.proxy.fr</li>
  <li>Proxy port : 1234</li>
  <li>Proxy Username : ProxyUser</li>
  <li>Proxy Password: ProxyPass</li>
  </ul>
  
  <p>How should I input all these parameters in pysftp so I can retrieve my files?</p>
  
  <p>EDIT:
  Using the answer from Martin Prikryl, I found some new stuffs to explore. 
  If I understand well, I need to use a socket. 
  Put I still have some problem to input all the information I need. </p>
  
  <pre><code>import socket
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  proxy = ("gw.proxy.fr",1234)
  sock.connect(proxy)
  target=("123.123.123.255",23)
  cmd_connect = "CONNECT {}:{} HTTP/1.1\r\n\r\n".format(*target)
  sock.sendall(cmd_connect)
  </code></pre>
  
  <p>The respond that I receive from this is <code>HTTP/1.0 407 Proxy Authentication Required</code>, which is kind of normal because I did not use the Proxy authentication information anywhere. So, do you have any idea how I can use them and input them into my socket ?</p>