def checkEnrollStatus(self, path): url = "{0}/{1}".format(resolver.getHost(), path) try: connection = self.opener.open(url) return connection.getcode() except urllib2.HTTPError as error: return 0
def sendMessage(self, path, queryparams): xml = None url = "{0}/{1}?{2}".format(resolver.getHost(), path, urllib.urlencode(queryparams)) try: connection = self.opener.open(url) print connection.getcode() if connection.getcode() == 200: xml = connection.read() else: xml = make_error(queryparams["name"], connection.getcode()) except urllib2.HTTPError as error: xml = make_error(queryparams["name"], error.code) return xml