curl-and-python
FTP upload through HTTP proxy
Date: Wed, 8 Aug 2007 08:52:11 +0530
Dear pycURL users,
I wish to upload to an FTP server through a HTTP proxy. Now, curl
works fine with the following (after the proxy environment variable is
set):
curl --verbose -T file "ftp://username:password@ftp.myftp.com"
How do I put it into pycurl code? The following gives me a (56,
'Received HTTP code 403 from proxy after CONNECT') error:
import pycurl
import getpass
c = pycurl.Curl()
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.UPLOAD, True)
c.setopt(pycurl.URL, "ftp://username:" + getpass.getpass() + "@ftp.myftp.com")
c.setopt(pycurl.PROXY, "http://myproxy")
c.setopt(pycurl.HTTPPROXYTUNNEL, True)
f = open("watch", 'r')
c.setopt(pycurl.READDATA, f)
f.close()
c.perform()
print b.getvalue()
And the same environment variables are set. Any pointers?
Thanks.
Kumar
-- Kumar Appaiah, 458, Jamuna Hostel, Indian Institute of Technology Madras, Chennai - 600036 _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-pythonReceived on 2007-08-08