I Python script works fine and exports a single space. But further analysis shows that it did NOT pick up a restricted page.
This appears to of been fixed with CONF-12595? I assumed I needed the confluence2.exportSpace call with the 4th parameter?
Here is my code:
********************
#!/usr/bin/python
#
# Description:
# Export ONE space at a time.
#
# PROGRAMMER NOTES;
# Used to grab either a data or personal spaces. Good for testing access and/or
# grabbing one space at a time.
#
import xmlrpclib
import time
import urllib
import sys
total = len(sys.argv)
cmdargs = str(sys.argv)
print ("Args list: %s " % cmdargs)
if total <= 2:
print ("Usage: %s [global|personal] [key]" % sys.argv[0])
exit();
elif total == 3:
type = sys.argv[1]
if (type != 'global') and (type != 'personal'):
print ("Invalid value passed for type [%s]. Please enter either 'global' or 'personal'", type)
exit()
key = sys.argv[2]
server = xmlrpclib.ServerProxy('http://localhost:8280/rpc/xmlrpc')
token = server.confluence2.login('userName', 'passWord')
print ("Exporting the space with key of [%s]" % (key) )
# The URL where space is going to be exported too is returned.
spaceDownloadUrl = server.confluence2.exportSpace(token, key, "TYPE_XML")
#This one does not work, below!
#spaceDownloadUrl = server.confluence2.exportSpace(token, key, "TYPE_XML", True)
print "URL to be exported [%s]" %spaceDownloadUrl
# Get the filename off the end of the the URL
filename = "global/" + key + "_" + spaceDownloadUrl.split('/')[-1].split('#')[0].split('?')[0]
print "filename is [%s]" %filename
time.sleep(0.5)
loginString = "?os_username=userName&os_password=passWord";
urllib.urlretrieve (spaceDownloadUrl + loginString, filename)
print filename + " saved."
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.