btw0
btw0

Reputation: 3626

Is there a uniform python library to transfer files using different protocols

I know there is ftplib for ftp, shutil for local files, what about NFS? I know urllib2 can get files via HTTP/HTTPS/FTP/FTPS, but it can't put files.

If there is a uniform library that automatically detects the protocol (FTP/NFS/LOCAL) with URI and deals with file transfer (get/put) transparently, it's even better, does it exist?

Upvotes: 3

Views: 1527

Answers (2)

jnoller
jnoller

Reputation: 1179

You want to look up and use pycurl/libcurl. Libcurl: http://curl.haxx.se/ PyCurl: http://pycurl.sourceforge.net/ - curl supports the http://, file://, and ftp:// uris. I have used it with much success.

Upvotes: 2

Philippe F
Philippe F

Reputation: 12175

Have a look at KDE IOSlaves. They can manage all the protocol you describe, plus a few others (samba, ssh, ...).

You can instantiates IOSlaves through PyKDE or if that dependency is too big, you can probably manage the ioslave from python with the subprocess module.

Upvotes: 1

Related Questions