def call(self, name, args): url = self.url + call_to_url_path(name, args) u = urllib2.urlopen(url) okay, res = deserialize(u.read()) if okay: return res try: exc = getattr(exceptions, res.name) raise exc(res.value) except AttributeError: # One of res.name, res.value, or the getattr raise res
def url_path_to_call(path): name, args = deserialize(path.decode("base64")) return name, args