Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
GetArchiveInfo
import requests, re, time, getpass
from xml.dom.minidom import parseString
def getVaultInfo(archiveId, user, password, evServerRoot):
url = evServerRoot + "/EnterpriseVault/GetVaultInformation.aspx"
headers = {'archiveId': archiveId}
r = requests.get(url, data=headers, auth=(user, password))
if r.status_code == requests.codes.ok:
dom = parseString(r.content)
topNode = dom.getElementsByTagName('CONTENTCACHE')[0]
archiveSize = int(topNode.getAttribute('ItemSize'))
archiveSizeinMb = archiveSize / 1024
archiveSizeinGb = archiveSizeinMb / 1024
print 'Archive size is: ' + str(archiveSizeinMb) + 'Mb. (~' + str(archiveSizeinGb) + 'GB)'
print 'Archive start date: ' + topNode.getAttribute('StartDate')
print 'Newest Archived item: ' + topNode.getAttribute('EndDate')
else:
print 'Unable to perform requested action. Reason/Status: ' + str(r.status_code)
if __name__ == "__main__":
userName = raw_input('Domain\Username: ')
password = getpass.getpass()
archiveId = raw_input('Archive ID: ')
evServerRoot = raw_input('EV Server address (i.e. http://VaultSrv1.myCorp.com): ')
getVaultInfo(archiveId, userName, password, evServerRoot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment