curl-and-python
Connection Caching with SFTP
Date: Thu, 18 Oct 2007 11:49:03 +0200
Hi,
I use pycurl to transfer file using SFTP. I'm able to get a list of file for
a specific directory without any problem.
When i've the list of file to download, I download them. However, for each
file it creates a new connection.
An example of my code:
...
files = getListFiles
...
c = pycurl.Curl()
c.setopt(c.MAXCONNECTIONS, 10)
c.setopt(c.WRITEFUNCTION, myFunc)
for x in files:
c.setopt(c.URL, computeURL(x))
c.perform()
c.close()
* Connected to xxx (Y.Y.Y.Y) port 22 (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /home/jol/.ssh/id_dsa.pub
* Using ssh private key file /home/jol/.ssh/id_dsa
* Initialized SSH public key authentication
* Authentication complete
* Closing connection #0
* About to connect() to xxx port 22 (#0)
* Trying Y.Y.Y.Y.. * connected
* Connected to execus-rech-1 (Y.Y.Y.Y) port 22 (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /home/jol/.ssh/id_dsa.pub
* Using ssh private key file /home/jol/.ssh/id_dsa
* Initialized SSH public key authentication
* Authentication complete
* Closing connection #0
Do you know how I can avoid the reconnection process for each downloaded
file ?
Jol
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2007-10-18