iyuichiの私的開発ログ

渋谷で働くWebエンジニアのログ. Java, Android, iOS, Docker, GCP, AWS, ゲーム開発

WebDav接続

2つモジュール試してみた。
easywebdavの方が記述量が少なくてコードの見通しがよさげ。

tinydav

# tinydav : http://code.google.com/p/tinydav/
from tinydav import WebDAVClient
client = WebDAVClient("hostname", 80)
client.setbasicauth("user", "pass")
with open("local/path/to/file") as fd:
response = client.put("/remote path/filename", fd)

easywebdav

# easywebdav : https://github.com/amnong/easywebdav
# easy_install easywebdav
# sample
# webdav.mkdir('some_dir')
# webdav.rmdir('another_dir')
# webdav.download('remote/path/to/file', 'local/target/file')
# webdav.upload('local/path/to/file', 'remote/target/file')
import easywebdav
webdav = easywebdav.connect('hostname', port=80, username='user', password='pass')
webdav.upload('/LOCAL path/filename', '/remote path/filename')

ほかにもいいのあるのかな?