Hello, All-
I'm trying to write a quick "garbage truck" script to run through and dump the trash for all of our spaces, but I'm not sure how to return a list of all space keys.
s.confluence2.getSpaces(token)
Seems to return the info I needed, but I just need the key for each space so I can iterate through them with.
Here is the rest of the script for context. I don't need help with anything beyond just getting the space keys. Thanks!
#!/usr/bin/python import sys, os, urllib2, xmlrpclib from urllib2 import URLError, HTTPError wikiURL = "wiki url" password = "password" if password.endswith('\n'): password = password[:-1] username = "username" # Initialise XMLRPC session s = xmlrpclib.ServerProxy(wikiURL + "/rpc/xmlrpc") print "Logging in to " + wikiURL + " as user " + username token = s.confluence2.login(username, password) spaceList = s.confluence2.getSpaces(token) print spaceList spacekey = "SPACE" #deleteTrash = s.confluence2.emptyTrash(token, spacekey)
Community moderators have prevented the ability to post new answers.
Never mind- I'm not a python pro. Turns out I just needed to learn how dicts work
print "Logging in to " + wikiURL + " as user " + username token = s.confluence2.login(username, password) spaceInfo = s.confluence2.getSpaces(token) for space in spaceInfo: spaceKey = space['key'] print spaceKey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.