import time
import rawsc
import rawsc.service
from rawsc import rams
import rawsc.rams.service
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
try:
import cElementTree as ElementTree
except ImportError:
from elementtree import ElementTree
USER = "xxx"
PWD = "xxx"
SERVER = "rams.mon01.rambla.be"
try:
client = rawsc.rams.service.RamsService(username=USER, password=PWD, server=SERVER)
qry = rawsc.Query()
qry["year"] = "2010"
qry["month"] = "all"
feed = client.getStorageFeed(query = qry)
for e in feed.entry:
print "\nEntry URI: " + e.id.text
print "Year = %s, Month = %s" % (e.year, e.month)
print "Volume: " + str(e.content.params.volume.text)
except rawsc.service.Error, e:
print "Error Response from server, contents = %s.\n" % str(e)
error_dict = e[0]
print "status code : " + str(error_dict["status"]) + "\n"
if error_dict.has_key("body"):
print "error body : " + error_dict["body"] + "\n"
except rawsc.RawscException, e:
print "RawscException caught, reason = %s.\n" % str(e)
except StandardError, e:
print "StandardError caught, reason = %s.\n" % str(e)
except:
print "unhandled exception caught\n"