Cloudstor access to a public share via WebDAV

See CloudStor access via WebDAV for the beginning of this adventure. Having access data from my CloudStor account via WebDAV I was left wondering if you could do the same with something that had been publicly shared. It turns out you can, but once again, it's not obvious...

In [24]:
# Software setup is the same as last time
import webdav.client as wc
import random
import pandas as pd
import time
from credentials import *

Configuration

A bit of googling relating to OwnCloud, WebDAV, and public shares led me to this discussion. The critical thing is that you set the webdav_login to the value of the token in the share link, and the password to an empty string.

I uploaded a page from an ASIO file I'd harvested from the National Archives to my CloudStor account and created a public link: https://cloudstor.aarnet.edu.au/plus/s/yWvV1Mno3FWp6cO

The bit on the end is the token that you use as the login: yWvV1Mno3FWp6cO

The hostname is the same as last time, but what is the webdav_root? This had me flummoxed for a while, but eventually I realised that you had to change the remote.php in the standard WebDAV config to public.php.

BINGO!

In [25]:
options = {
    'webdav_hostname': 'https://cloudstor.aarnet.edu.au',
    'webdav_login':    'yWvV1Mno3FWp6cO',
    'webdav_password': '',
    'webdav_root': '/plus/public.php/webdav/'
}

Access the file

In [26]:
client = wc.Client(options)
In [27]:
client.list()
Out[27]:
['272217-p285.jpg']
In [28]:
client.info('272217-p285.jpg')
Out[28]:
{'created': None,
 'name': None,
 'size': '274306',
 'modified': 'Sun, 19 Jul 2015 10:29:01 GMT'}