Created
November 20, 2012 09:16
-
-
Save benheymink/4116897 to your computer and use it in GitHub Desktop.
GetArchiveInfo
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 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