Created
March 23, 2016 10:57
-
-
Save rhiaro/b9027def28ab437a6e9d to your computer and use it in GitHub Desktop.
Download all files in a container from a Solid server to local disc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from rdflib import Graph, URIRef, Namespace | |
import urllib | |
LDP = Namespace("http://www.w3.org/ns/ldp#") | |
def main(localdir, remote): | |
g = Graph() | |
g.parse(remote) | |
for s, p, o in g.triples( (URIRef(remote), LDP.contains, None) ): | |
filename = o.split('/')[-1] | |
urllib.urlretrieve(o, "%s/%s" % (localdir, filename)) | |
print "%s/%s" % (localdir, filename) | |
main(sys.argv[1], sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run
python files_from_solid.py path/to/local https://user.databox.me/path/to/files/