2009-08-05 17:34:45 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2009-08-07 17:40:03 +02:00
|
|
|
from config import hostname, port, username, password
|
2009-08-05 17:34:45 +02:00
|
|
|
|
|
|
|
import webdavlib
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import getopt
|
2009-08-10 18:25:40 +02:00
|
|
|
import xml.dom.ext
|
2009-08-05 17:34:45 +02:00
|
|
|
|
|
|
|
def parseArguments():
|
|
|
|
arguments = {}
|
|
|
|
|
|
|
|
depth = "0"
|
|
|
|
quiet = False
|
|
|
|
(opts, args) = getopt.getopt(sys.argv[1:], "d:q", ["depth=", "quiet"])
|
|
|
|
|
|
|
|
for pair in opts:
|
|
|
|
if (pair[0] == "-d" or pair[0] == "--depth"):
|
|
|
|
depth = pair[1]
|
|
|
|
elif (pair[0] == "-q" or pair[0] == "--quiet"):
|
|
|
|
quiet = True
|
|
|
|
|
|
|
|
# print "depth: " + depth
|
|
|
|
|
|
|
|
nargs = len(args)
|
|
|
|
if (nargs > 0):
|
|
|
|
resource = args[0]
|
|
|
|
if (nargs > 1):
|
|
|
|
properties = args[1:]
|
|
|
|
else:
|
|
|
|
properties = [ "allprop" ]
|
|
|
|
else:
|
|
|
|
print "resource required"
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
client = webdavlib.WebDAVClient(hostname, port, username, password)
|
|
|
|
propfind = webdavlib.WebDAVPROPFIND(resource, properties, depth)
|
|
|
|
client.execute(propfind)
|
2009-08-10 17:12:01 +02:00
|
|
|
|
2012-07-05 18:56:27 +02:00
|
|
|
sys.stderr.write("response:\n\n")
|
|
|
|
print propfind.response["body"]
|
2009-08-10 18:25:40 +02:00
|
|
|
|
|
|
|
if propfind.response.has_key("document"):
|
2012-07-05 18:56:27 +02:00
|
|
|
sys.stderr.write("document tree:\n")
|
2009-08-10 18:25:40 +02:00
|
|
|
xml.dom.ext.PrettyPrint(propfind.response["document"])
|